json,xml

plist,文件是xml

pragma mark --读取本地JSON文件

```
  • (NSDictionary *)readLocalFileWithName:(NSString *)name {
    // 获取文件路径
    NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"json"];
    // 将文件数据化
    NSData *data = [[NSData alloc] initWithContentsOfFile:path];
    // 对数据进行JSON格式化并返回字典形式
    return [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
    }

转载于:https://www.jianshu.com/p/c6cfbeee7064

猜你喜欢

转载自blog.csdn.net/weixin_34348111/article/details/91133563