iphone - Can't get email address using facebook sdk for IOS -
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 email address fb user, above code i'm getting id , name only. can please suggest me how can email address?
you need pass perameter whatever u want read like
[[[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) { if (!error) { nslog(@"resultis:%@",result); } else { nslog(@"error %@",error); } }];
Comments
Post a Comment