从字典中获取数据时出现以下错误
“ -[__NSCFString objectForKey:]: 无法识别的选择器发送到实例 0x4fbb80 ”
这是我的代码
NSDictionary *dic = [XMLReader dictionaryForXMLString:class.returnData error:nil];
MyGiftsarray = [[dic objectForKey:@"response"] objectForKey:@"gifts"];
for (NSDictionary *element in MyGiftsarray) {
[MyGiftsnamearray addObject:[element objectForKey:@"name"]];
[MyGiftsChkarray addObject:[element objectForKey:@"chk"]];
[MyGiftsIdarray addObject:[element objectForKey:@"id"]];
[MyGiftsApprovedarray addObject:[element objectForKey:@"approved"]];
[MyGiftsisCompletedarray addObject:[element objectForKey:@"completed"]];
}
这是我尝试从中获取数据的 NSDictionary。 MyGiftsDict->(
{
Appliedpoint = 500;
Requiredpoint = 5000;
approved = N;
chk = 50;
completed = 0;
id = 66;
name = "1-800Flowers.com";
},
{
Appliedpoint = 85;
Requiredpoint = 2500;
approved = N;
chk = 25;
completed = 0;
id = 71;
name = "Bath Body Works";
},
{
Appliedpoint = 5;
Requiredpoint = 2500;
approved = N;
chk = 25;
completed = 0;
id = 75;
name = "Buca di Beppo";
},
{
Appliedpoint = 36;
Requiredpoint = 2500;
approved = N;
chk = 25;
completed = 0;
id = 66;
name = "1-800Flowers.com";
},
{
Appliedpoint = 25;
Requiredpoint = 5000;
approved = N;
chk = 50;
completed = 0;
id = 90;
name = "Jelly Belly";
},
{
Appliedpoint = 120;
Requiredpoint = 500;
approved = N;
chk = 5;
completed = 0;
id = 129;
name = "Amazon.com";
}
)