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