Facebook iOS SDK - 在Graph API v2.4中获取朋友列表 [英] Facebook iOS SDK - get friends list in Graph API v2.4
问题描述
我正在使用下面的代码来获取使用应用程序的Facebook朋友
I am using below code to get Facebook friend that uses app
// Issue a Facebook Graph API request to get your user's friend list
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{friendlist-id}"
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
但我正在获得以下回应。
But I am getting following response.
{
data = (
);
summary = {
"total_count" = 279;
};
}
如何获取fbID,就像我们用来使用FBRequest最后一个api版本。
How can I get fbID like we use to get in last api version using FBRequest.
注意我正在使用最新的FB SDK。
Note I am using latest FB SDK.
谢谢。
推荐答案
您必须在登录时添加权限 user_friends
You have to add permission at login time user_friends
需要使用 user_friends
权限的用户访问令牌来查看该人的任何朋友列表。
A user access token with user_friends
permission is required to view any of that person's friend lists.
只能安装相同应用程序的朋友,
you can get only that friends who installed the same apps,
只有安装了此应用程序的朋友才会在API v2.0及更高版本中返回。总计的total_count表示朋友的总数,包括尚未安装应用程序的朋友总数。
Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"me/friends"
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
这篇关于Facebook iOS SDK - 在Graph API v2.4中获取朋友列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!