gpt4 book ai didi

ios - 无法获取 Facebook User_birthday、Swift2 中的位置

转载 作者:行者123 更新时间:2023-11-30 13:46:54 25 4
gpt4 key购买 nike

下面是我的代码:-

let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()

fbLoginManager .logInWithReadPermissions(["public_profile","user_birthday","email"], handler: { (result, error) -> Void in

if (error == nil)
{
let fbloginresult : FBSDKLoginManagerLoginResult = result

if(fbloginresult.grantedPermissions.contains("email"))
{
self.getFBUserData()
}
}
})
}

func getFBUserData()
{

if((FBSDKAccessToken.currentAccessToken()) != nil)
{
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, picture, email, gender, age_range, birthday"]).startWithCompletionHandler({ (connection, result, error) -> Void in
if (error == nil)
{
print(result)
self.performSegueWithIdentifier("login_with_facebook_vc", sender: nil)
}
})
}
}

我是 swift2 的新手。所以我无法获取 facebook user_birthdaylocation

请帮助我。

最佳答案

我使用此代码来接收电子邮件:

func getEmail() {

let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"email"])
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in

if ((error) != nil)
{
// Process error
print("Error: \(error)")
}
else
{
print("fetched user: \(result)")
if let facebookEmail: String = result.valueForKey("email") as? String {

print("email is: \(facebookEmail)")
self.email = facebookEmail

}
}
})

}

在生日时尝试这个

关于ios - 无法获取 Facebook User_birthday、Swift2 中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34810640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com