本地造假数据模拟服务器给的json

读取.json文件代码部分

 NSString * json = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"json"];
 
 NSData *data=[NSData dataWithContentsOfFile:json];
 NSError *error;
 NSDictionary * dict =[NSJSONSerialization JSONObjectWithData:data
 options:NSJSONReadingAllowFragments
 error:&error];
 

你可能感兴趣的:(本地造假数据模拟服务器给的json)