繁体   English   中英

iOS-Firebase-此电子邮件格式不正确

[英]IOS - Firebase - This email is badly formatted

在整合Firebase之后,我正在研究IOS项目。 我收到此错误“此电子邮件格式不正确”这是代码

 @IBAction func registerBtn(_ sender: Any) {

    if userNameTxt.text != "" && passwordTXT.text != "" {
        Auth.auth().createUser(withEmail: userNameTxt.text!, password: passwordTXT.text!, completion: { (user, error) in

            if error != nil {
                let alert = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
                let okButton = UIAlertAction(title: "OK", style: UIAlertActionStyle.cancel, handler: nil)
                alert.addAction(okButton)
                self.present(alert, animated: true, completion: nil)
            } else {

                UserDefaults.standard.set(user!.email, forKey: "user")
                UserDefaults.standard.synchronize()

            }


        })

    } else {
        let alert = UIAlertController(title: "Error", message: "Kullanıcı Adı ve Şifre Gerekli", preferredStyle: UIAlertControllerStyle.alert)
        let okButton = UIAlertAction(title: "OK", style: UIAlertActionStyle.cancel, handler: nil)
        alert.addAction(okButton)
        self.present(alert, animated: true, completion: nil)
    }

}

可能的空格说“字符串电子邮件= mEmail.getText()。toString()。trim();” 确保修剪

使用createUser时,Firebase会进行电子邮件验证。 检查userNameTxt标签中包含的字符串是否为有效电子邮件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM