我正在尝试解析从Web服务返回的JSON . 响应JSON看起来像这样 {"API_Count":"17"}
这是我的代码..只是想获得 Value (17) . 关键 Value . 这是我的代码......“基本”的东西一定是错的 . 我收到了错误
**[NSTaggedPointerString objectForKey:]: unrecognized selector sent to instance**
***Any ideas??***
NSData *jsonData = [responseObject dataUsingEncoding:NSUTF8StringEncoding];
NSError *err = nil;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&err];
for (NSDictionary *item in json )
{
NSObject *val = [item objectForKey:@"API_Count"];
// ERROR !!! [NSTaggedPointerString objectForKey:]: unrecognized selector sent to instance 0xa32b4de1b0d02c49
}
1 回答
NSDictionary * json = [NSJSONSerialization JSONObjectWithData:jsonData选项:NSJSONReadingAllowFragments错误:&err];
NSInteger val = [[json objectForKey:@“API_Count”] intergerValue];