Facebook获取好友列表 [英] Facebook Get friends list
问题描述
我正在使用 Facebook SDK v3.18
我只想得到用户的朋友列表和他们的照片。
登录:
FBLoginView * loginView =
[[FBLoginView alloc] initWithReadPermissions:
@ [@public_profile,@email,@user_friends]];
//水平对齐按钮在中间
loginView.frame = CGRectOffset(loginView.frame,(self.view.center.x - (loginView.frame.size.width / 2)),( self.view.center.y - (loginView.frame.size.height / 2)));
[self.view addSubview:loginView];
获取用户的朋友列表及其照片:
[FBRequestConnection startWithGraphPath:@/ me / friends?fields = name,picture
参数:nil
HTTPMethod:@GET
completionHandler :^(
FBRequestConnection * connection,
id result,
NSError * error
){
/ *处理结果* /
}];
但答案是:
{
data =(
);
summary = {
total_count= 1216;
};
}
而不是为我的朋友的名字或图片显示:/
请为此给我一些光。
提前感谢!
从 Facebook SDK页面,看起来/我/朋友只会返回已经登录并授予同一个应用程序的朋友(即您和您的朋友)朋友需要允许您的应用通过登录使用Facebook)。
I know it have been asked a lot here, but I can't find a proper answer for that.
I am using Facebook SDK v3.18
I simply want to get user friends list and their pictures .
I've tried so far this:
Login:
FBLoginView *loginView =
[[FBLoginView alloc] initWithReadPermissions:
@[@"public_profile", @"email", @"user_friends"]];
// Align the button in the center horizontally
loginView.frame = CGRectOffset(loginView.frame, (self.view.center.x - (loginView.frame.size.width / 2)), (self.view.center.y - (loginView.frame.size.height / 2)));
[self.view addSubview:loginView];
Get user's friends list and their pictures:
[FBRequestConnection startWithGraphPath:@"/me/friends?fields=name,picture"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
}];
But the answer is:
{
data = (
);
summary = {
"total_count" = 1216;
};
}
And non for my friends name or pictures are shown :/
Please put some light for me on this.
Thanks in advance!
From the Facebook SDK page, it looks like /me/friends will only return your friends that have logged in and given permission to the same app (i.e. you and your friends need to have permitted your app to use facebook via login).
这篇关于Facebook获取好友列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!