2

I am developing an App in Which I have implemented Facebook now I want to fetch Facebook user profile picture and Birthday in my app. I searched into net but all tutorials are 2 or 3 years old.

I have set permission like..

 loginButton.readPermissions=@[@"public_profile", @"email", @"user_friends",@"user_birthday",@"user_location"]; 

and fetching with codes

if ([FBSDKAccessToken currentAccessToken]) {
            [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
             startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                 if (!error) {
                     NSLog(@"fetched user:%@", result); 
} 

but the output is

  fetched user:{
email = "XYZ@gmail.com";
"first_name" = XYZ;
gender = male;
id = xxxxxxxxxxx;
"last_name" = ABC;
link = "https://www.facebook.com/app_scoped_user_id/xxxxxxxxx/";
locale = "en_GB";
name = "XYZ ABC";
timezone = "5.5";
"updated_time" = "2015-04-08T06:57:20+0000";
verified = 1;

}

Why i not getting birthday and profile picture information?

M Swapnil
  • 2,191
  • 2
  • 16
  • 31

1 Answers1

0

As Ashish mentioned, initWithGraphPath:@"me" parameters:nil does not return the profile_pic (or birthday) unless explicitly requested through initWithGraphPath:@"me" parameters:@{@"fields": @"picture, birthday"}

Be careful though, when parameters are not nil, it only returns the requested fields, so you won't get name, gender, etc unless you add them to the parameters explicitly as well

Ali Saeed
  • 1,332
  • 1
  • 15
  • 22