开发者

How do I communicate with remote servers from an iOS application?

I want to create an application which can communicate with my central server database.

Example: One time registration for every user and I want to store registration da开发者_如何学编程ta to my server database and show all users to show the list of all registered users.

What I have to do to implement this kind of thing?


You need to use NSURLConnection class to get this done. Alternatively, you can use ASIHTTPRequest, which, IMO, is much easier and user friendly. You can find ASIHTTPRequest here as well as detailed guide on how to set it up and use it: ASIHHTPRequest


Despite the advice you will get to use ASIHTTPRequest, or a variety of other frameworks that say they simplify networking, be aware that ASIHTTPRequest is no longer under active development.

If you are unsure about networking - just use the NSURLRequest/NSURLConnection path. It really isn't difficult to get up and running with it, and it works asynchronously with about 4 delegate calls. It's fast, built in, well integrated, well documented, and actively developed.

And, if in your application writing career, you think you might want to move on to using any other of these asynchronous networking wrappers, you'll be able to read the code, understand how they each handle different problems in different ways because you've had to face those problems while writing code yourself, and you'll be able to make an informed choice about which wrapper to use, rather than just picking one at random.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜