json文件转换plist文件

2017-11-24  本文已影响0人  果然小行家

NSString  *path = [[NSBundle mainBundle]pathForResource:@"city_province.json"ofType:nil];

NSLog(@"path = %@",path);

NSArray *array1 = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path]options:NSJSONReadingMutableLeaves error:nil];

NSString *newPath = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle]bundlePath],@"/city_province.plist"];

NSLog(@"newPath = %@", newPath);

[array1 writeToFile:newPath atomically:YES];

上一篇 下一篇

猜你喜欢

热点阅读