我用过这个方法,
NSDictionary *jsonObject=[NSJSONSerialization
JSONObjectWithData:jsonData
options:NSJSONReadingMutableLeaves
error:nil];
NSLog(@"jsonObject is %@",jsonObject);
它打印“jsonObject is null”。
“错误:nil”有什么问题吗?
我没有使用任何网址或连接方法。
我有一个 json 文件,我想将其显示在表格中。
请尝试以下代码。
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData
options:kNilOptions
error:&error];
NSArray* latestLoans = [json objectForKey:@"loans"];
NSLog(@"loans: %@", latestLoans);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)