I get the following error whenI launch my app
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '- [COViewController fetchAppNetData]: unrecognized selector
sent to instance 0x716d200'
Basically I am unable to find out how to parse the JSON data to my array. The structure of my JSON is as follows
{
"meta": {},
"data": []
}
I know that meta is a dictionary and data is an array. But when I try to use the following piece of code I get the above error
- (void)fetchAppNetData:(NSData *)responseData
{
//parse JSON data
NSError *error;
NSDictionary* appNet_json = [NSJSONSerialization
JSONObjectWithData:responseData options:kNilOptions error:&error];
NSArray* appNetTimeline = [[appNet_json objectForKey:@"meta"]
objectForKey:@"data"];
NSLog(@"AppNet Timeline : %@",appNetTimeline);
}
How do I make sure that I can identify the structure of JSON properly next time, so that I can avoid this sort of issue? I am extremely sorry to come up with such kind of doubts
fetchAppNetDataisn't defined in the object you're trying to use to call it. You never even get into the method.viewdidLoad[self performSelectorOnMainThread:@selector(fetchAppNetData) withObject:appNetData waitUntilDone:YES];:on the end of that selector name? Neither do I.