Reputation: 413
I have an array left over after parsing JSON that looks like ( -122.1407313, 37.7012704, 0 ) , How do I put them seperately into variables without an object or index to call? I tried:
NSArray *coordinates = [point objectForKey:@"coordinates"]; //holds the array above
NSString *lat = [coordinates objectAtIndex:0];
NSString *lon = [coordinates objectAtIndex:1];
Upvotes: 0
Views: 68
Reputation: 2953
You want something like:
NSNumber *lat = (NSNumber*)[coordinates objectAtIndex:0];
float latValue = [lat floatValue];
Upvotes: 2