现在的位置: 首页 > 综合 > 正文

iOS对json文件的读取

2018年05月12日 ⁄ 综合 ⁄ 共 322字 ⁄ 字号 评论关闭

 NSString *path = [[NSBundle mainBundle]  pathForResource:@"business_city" ofType:@"json"];
    NSLog(@"path:%@",path);
    NSData *jdata = [[NSData alloc] initWithContentsOfFile:path ];
    NSLog(@"length:%d",[jdata length]);
    NSError *error = nil;
    NSArray * Adata = [NSJSONSerialization JSONObjectWithData:jdata options:kNilOptions error:&error];

抱歉!评论已关闭.