美文网首页
iOS 将json文件转为plist文件

iOS 将json文件转为plist文件

作者: JohnayXiao | 来源:发表于2017-08-04 09:02 被阅读82次
 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];

相关文章

网友评论

      本文标题:iOS 将json文件转为plist文件

      本文链接:https://www.haomeiwen.com/subject/puxvlxtx.html