【发布时间】:2017-05-08 00:57:21
【问题描述】:
我正在尝试使用电子邮件运行 Google Firebase 身份验证的示例。当我尝试https://github.com/firebase/quickstart-ios/blob/master/authentication/AuthenticationExampleSwift/EmailViewController.swift 的电子邮件示例时,我在项目中遇到错误。
我的代码如下所示:
@IBAction func loginButtonTapped(_ sender: AnyObject) {
if let email = self.userEmailTextField.text, let password = self.userPasswordTextField.text {
showSpinner({
// [START headless_email_auth]
FIRAuth.auth()?.signIn(withEmail: email, password: password) { (user, error) in
// [START_EXCLUDE]
self.hideSpinner({
if let error = error {
self.showMessagePrompt(error.localizedDescription)
return
}
self.navigationController!.popViewController(animated: true)
})
// [END_EXCLUDE]
}
// [END headless_email_auth]
})
} else {
self.showMessagePrompt("email/password can't be empty")
}
}
我在showSpinner({...}) 和最后在self.showMessagePrompt("email/password can't be empty") 收到错误:
但是,showMessagePrompt 末尾的错误并没有出现在 self.showMessagePrompt 几行之前。可能和我的 Swift 版本有关,我尝试转换为 3,但之后我的整个项目就坏了。
【问题讨论】:
标签: ios swift firebase firebase-authentication