Can one help me with this how to consume json web service from iphone or ipad. here my requirement is implement json webservice using 开发者_Go百科API keys...
if possible post some tutorials or example links.....
thanks.....
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.
here is a link for a tutorial for consuming JSON web services from an iPhone app.
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.
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];
精彩评论