Question

I am using MKNetwork, to handle the Networking functionality of my application.

I am trying to read a JSON file, and save its content to a NSDictionary.

NSDictionary *valueDic = [[completedOperation responseJSON] objectForKey:@"value"];

The above code (responseJSON)works for iOS 5 and above. i need it to work for iOS 4 too. The author of this framework says the following; (see the comments section in this post)

Subclass MKNO and override that method and call
[super responseJSON] for iOS5 and return JSONKit(or equivalent) based dictionary for other versions

I have no clue how to implement this, Can someone please help me. I have been stuck in this the whole day.

Was it helpful?

Solution

Create a custom subclass of the MKNO an implement the responseJSON Method like:

- (NSDictionary *) responseJSON {
 return [ [self responseData] objectFromJSONData];
}

Don't forget to include "JSONKit.h"

PS: For future projects you should use: ASIHTTPRequest

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top