我正在閱讀一些json輸出...只是一些整數。第一個NSLog輸出完美的東西。在這種情況下,有3個元素。我不明白如何訪問我猜測的特定元素。從NSMutableArray中檢索「int」?
NSMutableArray *json = (NSMutableArray*)[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"json: %@ \n",json);
int count = (int)[json objectAtIndex:0];
int count1 = (int)[json objectAtIndex:1];
int count2 = (int)[json objectAtIndex:2];
NSLog(@"count %i %i %i\n",count,count1,count2);
爲什麼如果id聲明瞭方法-intValue就會強制轉換爲int? – CodaFi 2012-04-07 23:54:13