I used following code to get response from JSON response. It working very nicely in ios5 but for ios4 it is not working. So what will be solution in ios4.
NSData *responseData = [NSURLConnection sendSynchronousRequest:requestForServer returningResponse:&response error:&err];
NSDictionary *res = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&err];
for(id key in res)
{
id value = [res objectForKey:key];
NSString *keyAsString = (NSString *)key;
valueAsString = (NSString *)value;
NSLog(@"key: %@", keyAsString);
NSLog(@"value: %@", valueAsString);
}
Please help me if anyone knows ans of this.
NSJSONSerializationsince it is only supported on iOS 5.0+ and Mac OS X 10.7+. I think you can also have a try with third-party JSON Library>>>Edited
Jsonkit for both iOS4 and iOS5
Hope, this will help you..