我使用 PHP 脚本创建了一个 JSON。我正在阅读 JSON,可以看到数据已被正确读取。但是,在访问对象时,我将无法识别的选择器发送到实例...
似乎无法找到为什么在太多小时之后。任何帮助都会很棒!
我的代码如下所示:
NSDictionary *json = [[NSDictionary alloc] init];
json = [NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions error:&error];
NSLog(@"raw json = %@,%@",json,error);
NSMutableArray *name = [[NSMutableArray alloc] init];
[name addObjectsFromArray: [json objectForKey:@"name"]];
到达上面的最后一行时,代码会崩溃。
输出如下:
raw json = (
{
category = vacancies;
link = "http://blablabla.com";
name = "name 111111";
tagline = "tagline 111111";
},
{
category = vacancies;
link = "http://blobloblo.com";
name = "name 222222222";
tagline = "tagline 222222222";
}
),(null)
2012-06-23 21:46:57.539 Wind expert[4302:15203] -[__NSCFArray objectForKey:]: unrecognized selector sent to instance 0xdcfb970
帮助 !!!