jeudi 2 avril 2015

Facebook sdk 4 iOS user info email

I try to use the iOS Facebook SDK version 4.


i completed the login without problem,but impossible to get user email adresse using graph API. if someone have a solution for it can be very cool.


here my code, in view did load :



_FBButton = [[FBSDKLoginButton alloc] init];
_FBButton.readPermissions = @[@"public_profile", @"email"];



_FBButton.delegate = self;


here the method when login success :



- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error: (NSError *)error{



if ([FBSDKAccessToken currentAccessToken]) {


[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result2, NSError *error) {

if (!error) {
NSLog(@"fetched user:%@", result2);
}
}];
}
}


here the result :



"first_name" = Jack;
gender = male;
id = 1381385368853232;
"last_name" = Ammer;
link = "http://ift.tt/19KTshK";
locale = "fr_FR";
name = "Jack Ammer";
timezone = 2;
"updated_time" = "2015-04-02T07:26:35+0000";
verified = 1;


so why i can get the email adresse ?


thanks in advance.


Aucun commentaire:

Enregistrer un commentaire