我有一個NSDictionary中稱爲itemDict和打印從NSDictionary中獲取密鑰值與GOOGLEPLUS類
NSLog(@"itemDictValues:%@",itemDict);
輸出是在該格式時:
itemDictValues:
GTLPlusPerson 0xab821e0:
{etag:""LTv_6IJISeUQGTVXLjMeOtebkoM/eup2crXcelmpMFKesXWlGkJjCiE"" kind:"plus#person" id:"1145282979128841" objectType:"person" displayName:"FirstName LastName" image:{url} url:"https://plus.google.com/1145282979128841"}
從這我需要提取對應的值到ID,displayName和url到我的NSString變量,在這種格式
profileId=1145282979128841;
Name=FirstName LastName;
Profilepic=https://plus.google.com/1145282979128841;
我該如何解決這個問題?
你說itemDict是一個NSDictionary,但它不會出現基於你說它不響應objectForKey。你可以在itemDict的設置方法上顯示一些代碼嗎?它不是一個NSDictionary,而是一個GTLPlusPerson? –
NSMutableArray * friends = [NSMutableArray array]; for(NSDictionary * itemDict in peopleFeed.items) { SocialProfile * friend = [[SocialProfile alloc] initWithDictionary:itemDict socialMedia:kSocialMediaGooglePlus]; [friends addObject:friend]; } – Gamerlegend
GTLPlusPeopleFeed * peopleFeed,是如何定義peopleFeed的。 – Gamerlegend