gpt4 book ai didi

xcode - 登录并读取权限(_ :handler:)' is deprecated: use logInWithReadPermissions:fromViewController:handler: instead

转载 作者:行者123 更新时间:2023-11-30 10:03:55 28 4
gpt4 key购买 nike

使用最新的 XCode,我收到此错误:

'logInWithReadPermissions(_:handler:)' is deprecated:
use logInWithReadPermissions:fromViewController:handler: instead'

我该如何重新格式化我的代码?这是它所在的整个函数:

@IBAction func fbBtnPressed(sender: UIButton!) {
let facebookLogin = FBSDKLoginManager()

facebookLogin.logInWithReadPermissions(["email"]) {
(facebookResult: FBSDKLoginManagerLoginResult!,facebookError: NSError!) in
print("Facebook login failed. Error \(facebookError)")
}
}

最佳答案

Xcode 8.2 测试版 (8C30a):

    fbLoginManager.logIn(withReadPermissions:["email"], from: self, handler: {

(result, error) -> Void in

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

if(fbloginresult?.isCancelled)! {
//Show Cancel alert
} else if(fbloginresult?.grantedPermissions.contains("email"))! {
//self.returnUserData()
//fbLoginManager.logOut()
}
}
})

关于xcode - 登录并读取权限(_ :handler:)' is deprecated: use logInWithReadPermissions:fromViewController:handler: instead,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37106799/

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