首页 文章

NSDictionary - 无法识别的选择器发送到实例 - 错误

提问于
浏览
0

我正在尝试解析从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 回答

  • 0

    NSDictionary * json = [NSJSONSerialization JSONObjectWithData:jsonData选项:NSJSONReadingAllowFragments错误:&err];

    NSInteger val = [[json objectForKey:@“API_Count”] intergerValue];

相关问题