我有一个 JSON 响应:
{"result":
[
{"id":"1","inviter":"someguy1","invitee":"test","group_id":"1","status":"2"},
{"id":"2","inviter":"someguy2","invitee":"test","group_id":"1","status":"2"}
]
}
我正在尝试通过以下方式打印每个 dict 的所有值:
NSDictionary* res = [[json objectForKey:@"result"] objectAtIndex:0];
for(id object in res){
NSDictionary *currentResult = (NSDictionary *)object;
for(NSString *value in [currentResult allValues]){
NSLog(@"value: %@", value);
}
}
应用程序崩溃:
*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFString allValues]:无法识别的选择器发送到实例 0x96d43b0”
上for(NSString *value in [currentResult allValues])
线。
有什么想法/建议/诀窍吗?