问题
Instead of accessing specific latitude with hardcoded as shown in below
NSString *path = [[NSBundle mainBundle] pathForResource:
@"WellList" ofType:@"plist"];
NSMutableDictionary *root = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
NSString* latitude = [[[[[root objectForKey: @"Routes"] objectForKey: @"Houston" ] objectForKey: @"Location 1"] objectForKey: @"coordinate"] objectForKey: @"latitude"];
I would like to use loop to access every single coordinate in my plist and add them into my NSmutableArray.

回答1:
NSMutableDictionary *root = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
NSDictionary *routes = [root objectForKey: @"Routes"];
NSArray *cities = [routes allValues];
for (NSDictionary *city in cities) {
NSArray *locations = [city allValues];
for (NSDictionary *loc in locations) {
NSDictionary *coord = [loc objectForKey:@"coordinate"];
NSLog(@"%@",[coord objectForKey:@"latitude"]);
}
}
来源:https://stackoverflow.com/questions/17752710/accessing-coordinates-in-plist-ios