Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

ios - Facebook Get friends list

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...