0

I found numerous solutions here for getting my friends on Facebook in an iOS app. I wrote something similar that worked for a while, shown below. But as of yesterday, it's only getting one friend instead of all 100 of my friends. Yes, I checked just now to make sure 99 of them didn't unfriend me. That one friend is my second account, which is also signed up as a tester for my app.

Here's what I've been using after the user has logged into Facebook on the app:

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
    [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                                  NSDictionary* result,
                                                  NSError *error) {
        NSArray* tempFriends = [result objectForKey:@"data"];
        NSLog(@"NetworkHandler retrieved friend list (%lu friends).", (unsigned long)tempFriends.count);
        for (NSDictionary<FBGraphUser>* user in tempFriends){
            // Handle retrieved friends...
        }
    }];

Output: "NetworkHandler retrieved friend list (1 friends)." I've tried setting a breakpoint in the completion block to be sure. The array has one item, an id<FBGraphUser> representing my second account.

sudo
  • 5,604
  • 5
  • 40
  • 78
  • 1
    The (rather) new feature of Graph API 2.0 is that calling /me/friends returns only the person's friends *who also use the app*. The same goes with `[FBRequest requestForMyFriends]`. – Markus Rautopuro Jul 16 '14 at 17:16
  • WizKid's link answered my question. I'm shocked because it was working about 4 days ago and because Facebook's own Friend Picker sample is now broken, but I have decided that my app can live without knowing all the users' friends. Still annoying that I need to get permission since I was before working off default permissions only until this happened. – sudo Jul 16 '14 at 17:19
  • 1
    I guess upgrading to use 2.0 was optional for a while and now they forced it (at least to your app). The same happened to me a couple of months ago. No workaround. – Markus Rautopuro Jul 16 '14 at 17:31

0 Answers0