简体   繁体   中英

Fetch Facebook friends list of logged user

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM