FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
login.loginBehavior = FBSDKLoginBehaviorSystemAccount;
[login logInWithReadPermissions:@ [@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error)
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
else if (result.isCancelled)
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
else
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
if ([result.grantedPermissions containsObject:@"email"])
{
if ([FBSDKAccessToken currentAccessToken])
{
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"fetched user:%@", result);
}
}];
}
}
}
}];
I want to get email address for FB user, But from above code I'm just getting id and name only. Can anyone please suggest me how can I get email address?