前提・実現したいこと
ここに質問の内容を詳しく書いてください。
初心者です。
swiftでSNSアプリを作成しています。
Firebaseを使用してユーザーの認証を行っています。
発生している問題・エラーメッセージ
アプリはビルドは成功します。 ユーザーのメールとパスワード入力のところで、 メールアドレスとパスワードの両方が記入されている場合Resistered Succesfullyというメッセージが出て画面が遷移するようにしています。 今現在これは成功します。 しかし、 ・メールアドレスが登録済み・メールの書式の間違い・パスワードが5文字以下・空文字を指定した場合にもResistered Succesfullyというメッセージが出てしまいます。しかし、画面遷移はせず、エラーにはなっているようです。 適切なエラーメッセージを表示するにはどのように改めればよいか教えていただきたいです。 よろしくお願いします。
@IBAction func didTapSignup(_ sender: Any) {
signUp.isEnabled = false Auth.auth().createUser(withEmail: email.text!, password: password.text!, completion: { (user, error) in if(error == nil) { if(error!._code == 17999) { self.errorMessage.text = "Inavlid email Addless" } else { self.errorMessage.text = error?.localizedDescription } } else { self.errorMessage.text = "Resistered Succesfully" Auth.auth().signIn(withEmail: self.email.text!, password: self.password.text!, completion: { (user, error) in if (error == nil) { self.databaseRef.child("user_profiles").child(user!.user.uid).child("email").setValue(self.email.text!) self.performSegue(withIdentifier: "HandleViewSegue", sender: nil) } }) } }) }
swift
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/13 13:50