我一直在阅读文档,我找不到任何东西。对于其他属性,如name,id等,它们在FBGraphUser类中可用。我需要的是用户的兴趣列表。我相信我必须使用FBGraphObject类,但我不确定如何去做。任何指导都将非常感激。谢谢!
答案 0 :(得分:0)
me / interest是您如何获得用户的兴趣。如果你正在寻找其他人,比如用户的朋友,那么id / interest
这取决于用户登录
-(void)fbRequest{
[FBRequestConnection startWithGraphPath:@"me/interests" completionHandler:^(FBRequestConnection *connection,NSDictionary<FBGraphObject> *result,NSError *error){
if(!error){
NSArray *data = [result objectForKey:@"data"];
[self updateInterests:data];
}else{
}
}];
}
-(void)updateInterests:(NSArray*)interests
{
NSString *str = self.groupList.text;
for(FBGraphObject <FBGraphUser>*interest in interests) //Using FBGraphUser because it implements name though I'd love to use something else
{
str = [str stringByAppendingFormat:@"%@\n",interest.name ];
}
[self.groupList setText:str];
}
上述方法的替代方案并不依赖于graphuser具有名称的巧合,所以这里是
-(void)updateInterests:(NSArray*)interests
{
NSString *str = self.groupList.text;
for(FBGraphObject *interest in interests) //Using FBGraphUser because it implements name though I'd love to use something else
{
str = [str stringByAppendingFormat:@"%@\n",[interest objectForKey:@"name"] ];
}
[self.groupList setText:str];
}