[英]Getting email from facebook user info
Using this methods Facebook iOS 6 - get user info I can get the profile user info from Facebook, but in the json file are not retrieving the email of the user. 使用此方法, Facebook iOS 6-获取用户信息我可以从Facebook获取配置文件用户信息,但在json文件中未检索用户的电子邮件。
Can you helpme to get the email?? 您能帮我获取电子邮件吗?
Thanks in advance! 提前致谢!
You should get email in this way: 您应该以这种方式收到电子邮件:
[user objectForKey:@"email"]//Where user is FBGraphUser type
Here is the implementation when login is successful 这是成功登录后的实现
case FBSessionStateOpen: {
NSLog(@"accessToken: %@", session.accessTokenData.accessToken);
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (error) {
//error
}else{
NSLog(@"%@, %@",[user objectForKey:@"email"], user.description);
}
}];
}
break;
Try this : 尝试这个 :
facebook = [[Facebook alloc] initWithAppId:[self _APP_KEY] andDelegate:self];
[facebook authorize:[NSArray arrayWithObjects:@"email",nil]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.