1

I am trying to fetch facebook friend of logged user in my iphone app. i use Facebook sdk v2.2. facebook code return only one friend detail.but in the my facebook acccount 11 friends. i used xcode 5.1 and my development target 7.1

here is my code.

[FBRequestConnection startWithGraphPath:@"/me/friends"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          ) {
                          /* handle the result */

                          NSLog(@"friend list = %@",result);
                          NSArray* friends = [result objectForKey:@"data"];
                          NSLog(@"friends = %@",friends);


                      }];

Please suggest to me where am i wrong. Thank you for give your precious time for suggestion.

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
Om Prakash
  • 9,191
  • 1
  • 12
  • 20

1 Answers1

4

You are experiencing the correct behaviour. From the v2 of the Graph API, you can only get the list of friends who authorized your app already. In your case, it looks like only one of your friends used your app.


API Reference /{user-id}/friends

This will only return any friends who have used (via Facebook Login) the app making the request.

Source: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • Thank you for your feedback. but i want all those friends who have not use my app and not login via facebook in my app. – Om Prakash Dec 15 '14 at 13:27
  • You can't do that *anymore*. They must have logged in into your app. You don't have the choice, you have to build your app without it! You can't get **a list** of your friends, however these friends are not invisible as you can still access their information if they interacted with you in some way (i.e. posted on your timeline, sent you a message, etc.). – Stéphane Bruckert Dec 15 '14 at 13:30
  • 1
    @StéphaneBruckert well explained and also given link about it you have to read the doc. Facebook now change there API log after upgrade v1 to v2. You can not get all friend list now. You just got list of friends that used your app. – Nitin Gohel Dec 15 '14 at 13:34
  • Thank you all of you for give feedback of my question. – Om Prakash Dec 15 '14 at 13:47