读取本地json文件

来源:互联网 发布:淘宝产品恶意投诉假货 编辑:程序博客网 时间:2024/05/16 09:00

如何读取本地json文件:

NSString *textPath = [[NSBundlemainBundle]pathForResource:@"test1"ofType:@"json"];

NSData *textData = [NSDatadataWithContentsOfFile:textPath];

NSDictionary *textDic = [NSJSONSerializationJSONObjectWithData:textDataoptions:NSJSONReadingAllowFragmentserror:nil];


0 0
原创粉丝点击