SwiftとFirebaseを使用して、メールアドレスログイン機能を実装しようとしています。
新規登録の処理として、
Swift
1class NiViewController: UIViewController { 2 3 @IBOutlet var mailAddressText: UITextField! 4 @IBOutlet var passwordText: UITextField! 5 6 7 @IBAction func onTouchedSignUpButton(_ sender: Any) { 8 if let email = mailAddressText.text, let password = passwordText.text { 9 10 Auth.auth().createUser(withEmail: email, password: password) { (user, error) in 11 12 if let error = error{ 13 let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert) 14 alert.addAction(UIAlertAction(title: "OK", style: .default)) 15 self.present(alert, animated: true, completion: nil) 16 } else { 17 self.performSegue(withIdentifier: "next", sender: self) 18 } 19 } 20 21 } 22 23 }
とコードを書いたところ、ビルドして画面遷移はするのですが、データがFirebaseAuthに保存されません。
見たところ、
whose view is not in the window hierarchy!
と表示されており、これが原因の一部なのではないかと考えています。
viewDidLoad内は最初のままで、何も書き加えていません。
どなたか教えていただけると幸いです。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/04 07:52