2017-11-27 7 views
0

私はIOSベースのプロジェクトで、Firebaseの統合後に作業しています。私は、このエラーは、「このメールはひどくフォーマットされて」そうだ はここのcreateUserを使用しているときFirebaseは、電子メールの検証を行うコードIOS - Firebase - この電子メールはフォーマットが間違っています

@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) 
    } 

} 

答えて

0

です。 userNameTxtラベルに含まれる文字列が有効なメールかどうかを確認してください。

+0

をチェックしました!これは有効なメールです –

+0

エラーがポップアップしたときにそのラベルを通過している電子メールの例を表示できますか? – Oxthor

+0

[email protected] –

関連する問題