如何使用Facebook Graph API从用户获取特定数据字段?

时间:2011-04-27 00:56:34

标签: ios objective-c facebook-graph-api parameters

我正在努力有效地使用Graph Api。

在为我/朋友点击facebook服务器并将所有朋友ID解析为字典(我正在使用Objective C for Iphone开发)之后,我希望得到关于每个朋友的某些信息。

让我们来看一个收集我所有朋友生日的经典例子。注意:我已被授予friends_birthday权限。

以下代码使用oAuth2Test Framework:

while ((friend_list = (NSDictionary *)[enumerator nextObject])) {
    //NSString *name = (NSString *)[friend_list objectForKey:@"name"];
                NSString *idd = (NSString *)[friend_list objectForKey:@"name"];

    //The following line would return this users birthday along with all the other information the user is allowed to see/has granted permission for.

    FbGraphResponse *fb2_graph_response = [fbGraph doGraphGet:idd withGetVars:nil];
}

我如何使用字典作为“withGetVars”的参数来仅拉动每个用户的生日?

2 个答案:

答案 0 :(得分:0)

获取特定人物的个人资料的简单技巧。而不是传递me/feed传递特定的人ID,例如。 1234567/feed,您将获得他的个人资料详情。

答案 1 :(得分:0)

您可以使用fields=birthday参数使用以下图表调用:

me/friends?fields=id,name,birthday