gpt4 book ai didi

ios - Facebook Swift SDK : loginManager Type of expression is ambiguous error

转载 作者:IT王子 更新时间:2023-10-29 05:25:05 33 4
gpt4 key购买 nike

我正在使用以下代码将 facebook 登录添加到 UIButton 操作:

func facebookButtonClicked(sender: UIButton) {
let loginManager = LoginManager()

loginManager.logIn([.PublicProfile], viewController : self) { loginResult in
switch loginResult {
case .Failed(let error):
print(error)
case .Cancelled:
print("User cancelled login")
case .Success(let grantedPermissions, let declinedPermissions, let accessToken):
print("Logged in")
}
}
}

Xcode 抛出以下错误:

Type of expression is ambiguous without more context

对于 [.PublicProfile] 部分。

知道我在这里做错了什么吗?

最佳答案

最终的解决方案是这个:

 let loginManager=LoginManager()
loginManager.logIn(readPermissions: [ReadPermission.publicProfile], viewController : self) { loginResult in
switch loginResult {
case .failed(let error):
print(error)
case .cancelled:
print("User cancelled login")
case .success(let grantedPermissions, let declinedPermissions, let accessToken):
print("Logged in")
}
}

Facebook 还没有更新自己的代码示例...

关于ios - Facebook Swift SDK : loginManager Type of expression is ambiguous error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39713490/

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