Google身份验证使用Firebase
问题描述:
我在Xcode 8中使用了Swift 3,并且在代码中获得了此门。有什么方法可以解决它吗?我很感激任何人都可以帮忙。Google身份验证使用Firebase
FIRAuth.auth()?.signIn(with: credential, completion: {(user: FIRUser?, error: NSError?) in
if error != nil {
print(error!.localizedDescription)
return
}else {
print(user?.email)
print(user?.displayName)
错误:下面我已经添加了名为“用户”为用户对象
Cannot convert value of type '(FIRUser?, NSError?) ->()' to expected argument type 'FIRAuthResultCallback?'
答
你完成块需要变量名的返回值(用户对象和错误)在本例中和错误对象的错误。
FIRAuth.auth()?.signIn(with: credential, completion: {(user, error) in
if error != nil {
print(error!.localizedDescription)
return
}else {
print(user?.email)
print(user?.displayName)
答
其实,在Xcode 8中,有时候我们打开完成块有问题。而在你的代码块中打不开。你的块都应该打开为:
FIRAuth.auth()?.signIn(with: credential , completion: { (user, error) in
//Do as per your need here
})
希望,这有助于