Facebook 获取好友列表 [英] Facebook Get friends list

查看:43
本文介绍了Facebook 获取好友列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这里有很多人问过这个问题,但我找不到合适的答案.

I know it have been asked a lot here, but I can't find a proper answer for that.

我正在使用 Facebook SDK v3.18

我只想获取用户好友列表和他们的照片.

I simply want to get user friends list and their pictures .

到目前为止我已经尝试过:

I've tried so far this:

登录:

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 */
                      }];

但答案是:

{
    data =     (
    );
    summary =     {
        "total_count" = 1216;
    };
}

非我朋友的名字或图片显示:/

And non for my friends name or pictures are shown :/

请帮我解释一下.

提前致谢!

推荐答案

来自 Facebook SDK 页面,看起来/me/friends 只会返回已登录并授予同一应用权限的朋友(即您和您的朋友需要允许您的应用通过登录使用facebook).

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆