-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user ////////////////////////////// fetch logged in user information
{
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
NSString *firstName = user.first_name;
NSString *lastName = user.last_name;
NSString *facebookId = user.id;
NSString *email = [user objectForKey:@"email"];
NSString *imageUrl = [[NSString alloc] initWithFormat: @"http://graph.facebook.com/%@/picture?type=large", facebookId];
NSLog(@" f0000000 %@",imageUrl);
NSLog(@" email ===== %@",email);
}
}];
}
NSString *email_id= [user objectForKey:@"email"];
NSLog(@" fetch yo ----->%@",user.name); /////
NSLog(@" object ----->%@",email_id);
}
输出 - - - - - -
f0000000 http://graph.facebook.com/******/picture?type=large
email ===== (null)
f0000000 http://graph.facebook.com/*****/picture?type=large
email ===== (null)
我收到的电子邮件为空。如何获取用户或当前登录用户的电子邮件。我是 ios 新手,不知道该怎么做。