OC读取plist文件:
#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { @autoreleasepool { NSArray * arr = [NSArray arrayWithContentsOfFile:@"/Users/zl201/Desktop/NSDictionaryHomework/ProvincesAndCities.plist"]; //使用绝对路径 for (NSDictionary *dic in arr) { NSArray * cities = [dic objectForKey:@"Cities"]; for (NSDictionary * city in cities) { NSString * cityName = [city objectForKey:@"city"]; NSString * lat = [city objectForKey:@"lat"]; NSString * lon = [city objectForKey:@"lon"]; NSLog(@"%@ lat = %@ lon = %@",cityName,lat,lon); } } } return 0; }
本文转蓬莱仙羽51CTO博客,原文链接:http://blog.51cto.com/dingxiaowei/1366442,如需转载请自行联系原作者