nik
nik

Reputation: 2329

json webservice from iphone/ipad

Can one help me with this how to consume json web service from iphone or ipad. here my requirement is implement json webservice using API keys...

if possible post some tutorials or example links.....

thanks.....

Upvotes: 2

Views: 9615

Answers (4)

Bourne
Bourne

Reputation: 10312

Check this out. Shows JSON used with Flickr API's on a native app:

http://iosdevelopertips.com/networking/iphone-json-flickr-tutorial-part-1.html

Its a 3 part tutorial and links to the other parts are seen as you scroll to the bottom in the above link. They also have general JSON framework tutorials as well in two parts. Links again can be found in the above page itself. Very useful and pretty much helped me complete all the JSON stuff in my app. Project code is also available for download.

Upvotes: 2

Ravi_Parmar
Ravi_Parmar

Reputation: 12329

very simple example for GET request the : download and import AFJSONRequestOperation class.

NSURL *myUrl = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"your Url Here"]];
NSLog(@"url is --%@",myUrl);


NSURLRequest *request = [NSURLRequest requestWithURL:myUrl];
AFJSONRequestOperation *operation;

operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
                                                            success:^(NSURLRequest *req, NSHTTPURLResponse *responce, id jsonObject) {




                                                                    NSMutableDictionary *dictionary = [jsonObject objectForKey:@"Enter your key here that has some data"];




                                                            }
                                                            failure:^(NSURLRequest *req, NSHTTPURLResponse *responce, NSError *error, id jsonObject) {
                                                                NSLog(@"Recieved an HTTP %d", responce.statusCode);
                                                                NSLog(@"The error was: %@",error);
                                                            }];
[operation start];

Upvotes: 0

Dan Ray
Dan Ray

Reputation: 21903

The canonical JSON processing library is here, and was written by the Stig Brautaset. Stig's around SO and occasionally pops into obj-c-json discussions.

Upvotes: 3

Related Questions