我已经从 JSON 文件创建了一个 NSDictionary,但是当我尝试这样做时
NSString *key = [NSString stringWithFormat:@"%i",indexPath.row];
NSDictionary *currentObject = [JSONdata objectForKey:key];
我错误接收和错误-[__NSCFArray objectForKey:]: unrecognized selector sent to instance
当我这样做NSLog
时,JSONdata
这是我的输出:
(
{
1 = {
description = "";
facets = (
{
name = Red;
},
{
name = Blue;
},
{
name = Skinny;
},
{
name = Standard;
},
{
name = "Navy Blue";
}
);
id = 1073;
owner = 1001;
"post_date" = 1341980987;
transaction = 24;
username = TonyB;
};
},
{
2 = {
description = "";
facets = (
{
name = "Bow Tie";
},
{
name = Blue;
},
{
name = Orange;
},
{
name = Yellow;
}
);
id = 1001;
owner = 1001;
"post_date" = 1340640012;
transaction = 6;
username = TonyB;
};
}
)
我是否更正认为我应该能够获得的第一组密钥应该是1
并2
使用[JSONdata objectForKey:@"0"]
or [JSONdata objectForKey:@"1"]
?还是我错过了什么?