【发布时间】:2012-04-21 00:08:29
【问题描述】:
我正在读取一些 json 输出...只是一些整数。第一个 NSLog 完美地输出了东西。在这种情况下,有 3 个元素。我不明白如何访问我猜的特定元素。
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?
标签: objective-c nsmutablearray int