Search code examples
iosobjective-cfacebookfacebook-graph-apifbsdk

FBRequestConnection startForMyFriendsWithCompletionHandler NOT bringing all Friends who have installed the app - iOS


I have integrated Facebook in my app, and I'm trying to get my Facebook friends who have installed/authenticated the app by:

[FBRequestConnection startForMyFriendsWithCompletionHandler:
     ^(FBRequestConnection *connection, id<FBGraphUser> friends, NSError *error)
     {
         if(!error)
         {
             NSLog(@"results = %@", friends[@"data"]);
         }
     }];

It's only returning 12 friends who have my app installed, whereas I have more than 12 Facebook friends who have my app authenticated.

Please help why this is happening?


Solution

  • This is because even though more than 12 friends may have authenticated the app, not all of them may have chosen to grant user_friends permission. e.g. If User A is your friend who has authenticated your app but decided to not grant the user_friends permission, the API will not return the data for User A when you try to fetch the friends data. If you are looking to use this data for tagging purposes, then try the taggable_friends API instead.