我正在尝试从 Facebook 的 SessionLoginSample 应用程序中获取用户的电子邮件地址。我不确定我在这里做错了什么。我相信这是我获取电子邮件地址的正确区域。关于这部分内容将有助于我返回一封简单的电子邮件,您可以给我任何指导吗?任何帮助将不胜感激!谢谢!
- (void)updateView {
// get the app delegate, so that we can reference the session property
SLAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
if (appDelegate.session.isOpen) {
// valid account UI is shown whenever the session is open
[self.buttonLoginLogout setTitle:@"Log out" forState:UIControlStateNormal];
[self.textNoteOrLink setText:[NSString stringWithFormat:@"https://graph.facebook.com/me/friends?access_token=%@",
appDelegate.session.accessTokenData.accessToken]];
//GET THE USER'S EMAIL ADDRESS HERE
NSString *emailAddress= [user objectForKey:@"email"];
self.labelFirstName.text = [NSString stringWithFormat:@"Email: %@", emailAddress];
} else {
// login-needed account UI is shown whenever the session is closed
[self.buttonLoginLogout setTitle:@"Log in" forState:UIControlStateNormal];
[self.textNoteOrLink setText:@"Login to create a link to fetch account data"];
}
}