Hi,
I have an array that supposedly contains multiple dictionaries. I get this data from JSON and was wondering how to extract a single dictionary out of the array.
Here is how I am currently set up:
When I run this code, it crashes at
Is there another way to do this, or to see what is contained inside the array???
Thanks!
I have an array that supposedly contains multiple dictionaries. I get this data from JSON and was wondering how to extract a single dictionary out of the array.
Here is how I am currently set up:
Code:
NSError *error;
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers
error:&error]; //Parse JSON Data
NSDictionary *planesInRange = [json objectForKey:@"SearchBirdseyeInFlightResult"]; //Create Dictionary
NSMutableArray *aircraft = [[NSMutableArray alloc] init];
[aircraft addObject:[planesInRange objectForKey:@"aircraft"]];
NSMutableDictionary *currentPlane = [[NSMutableDictionary alloc] init];
for (int i = 0; i <= ([aircraft count] - 1); i++) {
currentPlane = [aircraft objectAtIndex:i];
//Some More Stuff
}
When I run this code, it crashes at
Code:
currentPlane = [aircraft objectAtIndex:i];
Is there another way to do this, or to see what is contained inside the array???
Thanks!