iOS 将json文件转为plist文件

来源:互联网 发布:淘宝退货不退钱怎么办 编辑:程序博客网 时间:2024/05/21 19:38
 NSString *path = [[NSBundle mainBundle] pathForResource:@"address.json" ofType:nil];    NSLog(@"path = %@",path);    NSArray *array = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] options:NSJSONReadingMutableLeaves error:nil];    NSString *newPath = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] bundlePath],@"/address.plist" ];    NSLog(@"newPath = %@", newPath);    [array writeToFile:newPath atomically:YES];
原创粉丝点击