I have a web service developed in ColdFusion that I am trying to consume on the iPhone. The web service returns JSON which should be fairly simple to read.
However, I have been unable to find a good simple example of an iPhone app calling a web service and using the data. Are there any good tutorials or examples out there that I am just missing?
A. Get ASIHTTPRequest.
B. Get json-framework.
C. Use A to get data from your web-service then hand it to B which returns a dictionary.
That's pretty much it.
To use JSON, you need to use a 3rd party framework, as there is no built-in support. I suggest using this http://code.google.com/p/json-framework/ as it's one of the simplest to implement. You can make the GET request just using NSURLRequest, or I'd also recommend using http://allseeing-i.com/ASIHTTPRequest/ if you need to make more complex requests, for example using basic authentication.
I wrote a blog post that has step-by-step instructions on using JSON from Cocoa/Objective-C with an example:
http://zachwaugh.com/2009/01/how-to-use-json-in-cocoaobjective-c/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With