Reputation: 17732
So I am making an app that is supposed to communicate with a webservice via basic HTTP requests. I spent quite a lot of time yesterday looking online and through the developer documentation not finding a whole lot of useful stuff. The best I managed to find was the CFNetwork Programming Guide in the iPhone developer docs, but this seemed to be lacking a lot of information and was very confusing.
For example: It tells me how to create requests and responses, deserialize both, but not how to submit requests, or receive responses. And as for a confusing bit, when creating the response it wants me to provide the status code. Shouldn't the response already contain that information?
Can someone please help? I really need to get this done soon.
Upvotes: 2
Views: 5832
Reputation: 1934
We did a bit of a walk through on our blog: How to consume JSON or XML Web APIs on iPhone smoothly It uses the ASIHTTPRequest library which makes things a lot easier.
Upvotes: 0
Reputation: 54445
If you simply want to be able to fire HTTP requests off, then I'd have thought using something like the NSString stringWithContentsOfURL:encoding:error:
and writeToURL:atomically:encoding:error:
methods would be a good starting point.
Alternatively, if you want to be able to fire off requests asynchronously, the NSURLConnection class should prove ideal.
Upvotes: 1
Reputation: 29175
While iOS native networking support is good, it is much easier to use this library: http://allseeing-i.com/ASIHTTPRequest/How-to-use It has several advantages, good documented examples and used by many projects.
Upvotes: 0