我需要在登录后从Facebook获取用户数据,使用此代码,我只能获取ID和名称,但不能获得电子邮件。
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!){
if error != nil{
print(error.localizedDescription)
return
}
FBSDKGraphRequest(graphPath: "/me", parameters: ["fields": "id, name, email"]).start { (connection, result, err) in
if err != nil {
print("Failed to start graph request:", err)
return
}
print(result)
}
}