0

我一直在阅读文档,但找不到任何东西。对于名称、id 等其他属性,它们在 FBGraphUser 类中可用。我需要的是用户的兴趣列表。我相信我必须使用 FBGraphObject 类,但我不确定如何去做。任何指导将不胜感激。谢谢!

4

1 回答 1

0

我/兴趣是你如何获得用户的兴趣。如果您正在寻找其他人,例如用户的朋友,则 id/interests

这取决于正在登录的用户

-(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];

}
于 2014-05-18T20:46:49.667 回答