0
我想從Facebook的SessionLoginSample應用程序的用戶的電子郵件地址獲取用戶的電子郵件。我不確定我在這裏做錯了什麼。我相信這是我獲得電子郵件地址的正確領域。您有什麼方向可以告訴我這將有助於我返回一個簡單的電子郵件嗎?任何援助將不勝感激!謝謝!從Facebook的iOS 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"];
}
}
您是否設置了權限? http://stackoverflow.com/questions/15481784/facebook-api-email-permissions – Chris