无法转换类型'(FIRUser,_)的值 - > ()'预期参数类型为'FIRAuthResultCallBack'错误

时间:2016-12-17 05:44:01

标签: swift3 xcode8

我是使用Swift 3的初学者 我收到错误:无法转换类型的值'(FIRUser,_) - > ()'预期参数类型为' FIRAuthResultCallBack?'

这是什么错误,如何解决?

func handleRegister() {

    guard let email = emailTextfield.text, let password = passwordTextfield.text else{
        print("Invalid Entry to Form")
        return
    }

    FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: {(user: FIRUser, error) in

        if error != nil {
            print(123456)
            return
        }
    })
}

1 个答案:

答案 0 :(得分:1)

请用以下代码替换您的代码:

FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: { (user, err) in
       if error != nil 
       {
            print(123456)
            return
       }
})