0

I want to fetch the list of user's facebook friends and i am using this code. but it is sending empty array.

Is there need for permission for this?

NSMutableDictionary* parameters1 = [NSMutableDictionary dictionary];
    [parameters1 setValue:@"email,friends" forKey:@"fields"];

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:@"/me/friends"
                                  parameters:parameters1
                                  HTTPMethod:@"GET"];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                          id result,
                                          NSError *error) {
          NSLog(@"%@",result);
        // Handle the result
    }];
Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
Jagdeep Singh
  • 2,556
  • 3
  • 18
  • 28
  • Possible duplicate of [Get Facebook Friend List in iOS](http://stackoverflow.com/questions/36187514/get-facebook-friend-list-in-ios) – jose920405 Apr 27 '16 at 14:10
  • Check this --> http://stackoverflow.com/questions/36187514/get-facebook-friend-list-in-ios/36188294#36188294 – jose920405 Apr 27 '16 at 14:11

3 Answers3

0

As per the updated policies of Facebook, You cannot directly fetch the list of friends in Facebook.

You can only fetch those friends who are using the same app for which you are asking for this permission.

Here's the detailed explaination: https://stackoverflow.com/a/23417628/1637677

Community
  • 1
  • 1
Rajan Balana
  • 3,775
  • 25
  • 42
0

You need below permissions taggable_friends :- Taggable Friends

Enables your app to call the Taggable Friends API on behalf of people who are not admins, developers or testers of your app.

The Taggable Friends API returns a list of all of a person's friends (both app-using friends and non-app-using friends) who can be tagged or mentioned in stories published by your app. The API returns each friend's name, a URL to a profile picture and a tagging token that can be used to tag them in Statuses, Links, Photos, Videos or Open Graph actions.

By default, you may only call the Taggable Friends API for people who are listed in the Roles section of your app's Dashboard. This is to allow you to develop and test your integration. If you want to use the Taggable Friends API in a public version of your app, you must submit this feature for review. Common Usage

Let people tag their friends in stories published by your app. This appends '-with Friend Name' to the end of the user message.

Let people mention their friends in-line in stories published by your app. Mentioning is only available in Open Graph stories that use certain additional capabilities. Learn more.

Use a person's friends for any purpose other than tagging or mentioning

user_friends:- Provides access to a person's list of friends that also use your app. This permission is approved by default.

You can only be able to access your friends with the above two ways only.

user1220945
  • 74
  • 1
  • 7
0

you can use this method to fetch information

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id, name, link, first_name, last_name, picture.type(large), email, birthday, bio ,location ,friends ,hometown , friendlists"}]
                 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {


    }
balkaran singh
  • 2,754
  • 1
  • 17
  • 32