0
嘿,伙计们,所以我有这样的代码:问题检索字符串从NSDictionary的
SJLog(@"dict: %@",dict);
,打印这本字典:
2011-05-04 02:37:51.537 Parking[14458:207] dict: {
"A_SPACES" = 0;
"DP_SPACES" = 7;
"LOT_DESC" = "West of the Maddy Lab off of West Health Science Dr.";
"LOT_ID" = 44;
"LOT_NAME" = LOT57;
"L_SPACES" = 0;
"MC_SPACES" = 8;
"VISITOR_SPACES" = 263;
"permits_accepted" = {
A = 1;
C = 1;
L = 0;
};
}
,我试图通过下面的代码检索LOT_DESC值:
SJLog(@"lot description from dict: %@ ",[dict objectForKey:@"@LOT_DESC"]);
但我得到这个:
2011-05-04 02:37:51.537 Parking[14458:207] lot description from dict: (null)
如果我使用[dict valueForKey:@"@LOT_DESC"]
我得到以下错误:
2011-05-04 02:44:28.148 Parking[14505:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFDictionary 0x58c8660> valueForUndefinedKey:]: this class is not key value coding-compliant for the key LOT_DESC.'
通过valueForKey
访问字典中的所有数值正常工作。所以,我不知道哪里出了问题,真的会喜欢一些建议。提前致谢!
主要捂脸......我觉得A F ***现在荷兰国际集团蠢蛋。谢谢。 – Stunner 2011-05-04 10:26:13