0
我有一個JSON響應:枚舉NSDictionary的NSDictionary;每提取元素的NSDictionary某個鍵
{"result":
[
{"id":"1","inviter":"someguy1","invitee":"test","group_id":"1","status":"2"},
{"id":"2","inviter":"someguy2","invitee":"test","group_id":"1","status":"2"}
]
}
我試圖通過打印出每個字典的所有值:
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])
行。
任何想法/建議/知道嗎?
謝謝,非常完美。 – samuelsaumanchan