iOS JSON文件转Plist文件
2016-10-17 本文已影响127人
Paco_Ke
NSString *path = [[NSBundle mainBundle] pathForResource:@"china_Updated.json" ofType:nil];
NSArray *array = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] options:NSJSONReadingMutableLeaves error:nil];
NSString *newPath = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] bundlePath],@"/city_province.plist" ];
NSLog(@"newPath = %@", newPath);
[array writeToFile:newPath atomically:YES];
//注:打印的路径找不到文件,可以尝试搜索本机可找到该文件