Facebook Swift SDK: loginManager Type of expression is ambiguous error
Try this for latest SDK
func facebookButtonClicked(sender: UIButton) {
let loginManager = LoginManager()
loginManager.logIn(readPermissions: [.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")
}
}
}
The final solution is this one:
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 hasn't updated its own codes' examples...