辞書からデータを取得中に次のエラーが発生します
" -[__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";
}
)