4

I used the FBRequest to request the friend list of user.

FBRequest *requestFriendList = [FBRequest requestForMyFriends];
[requestFriendList startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error){
                 if (!error)
                 {
                     NSArray *fbFriends = [result objectForKey:@"data"];
                     //...
                 }
             }];

However, the returned result of the request didn't contain any data. I printed out results, it contains the friend count, but no data inside.

Printing description of result:
{
    data =     (
    );
   summary =     {
        "total_count" = 585;
    };
}

If the request failed or the app doesn't have permissions, should it return an error or the "total_count" also is not shown?

So is there anything I did wrong? Anyone can help me fix this problem?

Thanks!!

Jing
  • 1,905
  • 2
  • 17
  • 25
  • 2
    You will need to ask for `user_friends` permission; and of course as everyone who hasn’t been in a coma for the last two month already knows, with API v2 your app will only be able to see friends of the user that are users of the app as well. – CBroe Sep 01 '14 at 22:28

1 Answers1

1

Graph API 2.0 changed the behaviour of the /friends endpoint. It now returns the list of friends who have authorized your Facebook app, as opposed to the complete list of friends. It's also a new permission - user_friends. From the Facebook Platform Changelog:

Friend list is no longer part of the default permission set and has its own permission: Asking for access to a person's friend list is now a separate permission that your app must request. The new permission is called user_friends.

Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.

Marty
  • 7,174
  • 1
  • 29
  • 50