2017-03-16 155 views
0

我在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?'

回答

0

你完成塊需要變量名的返回值(用戶對象和錯誤)在本例中和錯誤對象的錯誤。

FIRAuth.auth()?.signIn(with: credential, completion: {(user, error) in 
       if error != nil { 
        print(error!.localizedDescription) 
        return 
       }else { 
        print(user?.email) 
       print(user?.displayName) 
0

其實,在Xcode 8中,有時候我們打開完成塊有問題。而在你的代碼塊中打不開。你的塊都應該打開爲:

FIRAuth.auth()?.signIn(with: credential , completion: { (user, error) in 
     //Do as per your need here 
}) 

希望,這有助於