0

I am trying to get my friends profile picture and names from facebook. I created an app on facebook and i added "FacebookAppID", "FacebookDisplayName" and "URL Type" in .plist. But i can't pull the informations. Is it about permissions in facebook app? if it is, how can i get the permissions in facebook.

Here is my part of code;

- (IBAction)loginButtonTapped:(id)sender {

NSArray *permissionArray = [NSArray arrayWithObjects:@"user_about_me",nil];

[FBSession openActiveSessionWithReadPermissions:permissionArray  allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state,NSError *error) {

    [self sessionStateChanged:session  state:state  error:error];

}];
}

- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError  *)error
{

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
[friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                              NSDictionary* result,
                                              NSError *error) {
    NSArray* friends = [result objectForKey:@"data"];

    NSLog(@"Found: %i friends", friends.count);
    NSLog(@"result: %@ friends", result);
    for (NSDictionary<FBGraphUser>* friend in friends) {
        NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);



    }
}];

}

Thanks for your answer and interest.

Best Regards.

Kirdok
  • 1,904
  • 2
  • 22
  • 27
  • What errors do you see? – duci9y Jul 05 '14 at 15:47
  • Output is : Found: 0 friends , actually i am thinking about facebook app. Because, when i try with another facebook app, i can get informations, but i created new one, and i cant get with new appID – Kirdok Jul 05 '14 at 15:56
  • Bingo. Sounds like you have the app misconfigured on Facebook. – duci9y Jul 05 '14 at 15:58
  • Maybe try finding out what the problem is over at Facebook, and post a new question if you can't solve it. – duci9y Jul 05 '14 at 16:07
  • 1
    This problem -*empty friend list* have been discussed unlimited no of times here. Did you tried searching on SO before posting this? – Sahil Mittal Jul 06 '14 at 06:49
  • +1 for @SahilMittal. This has already been discussed endlessly here, and is still not possible with Graph API v2.0 because `/me/friends` only shows friends which also use your app. – Tobi Jul 07 '14 at 07:59
  • This is likely a duplicate of this question: http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-use-m?rq=1 – Simon Cross Aug 04 '14 at 17:35
  • in any case, the permission you need to get a person's app using friends is `user_friends`, not `user_about_me`. – Simon Cross Aug 04 '14 at 17:36

0 Answers0