Creating new user with firebase in Swift

后端 未结 4 1067
余生分开走
余生分开走 2021-01-15 17:36

I am new to Firebase and have been trying to implement a \"Sign Up\" page for my app. Currently, I am only using the email feature, just to test things out. I am able to cre

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 17:58

    Before you try any code, make sure your password is at least 6 characters. Print the error if is possible, I print the error on each function, sign up and sign in.

    @IBAction func signUp(_ sender: Any) {
    
    Auth.auth().createUser(withEmail: self.usernameTextField.text!, password: self.passwordTextField.text!) {(user, error) in
        if user != nil {
            print("User Has SignUp")
        }
        if error != nil {
            print(":(",error)
        }
    }
       Auth.auth().signIn(withEmail: self.usernameTextField.text!, password: self.passwordTextField.text!) {(user, error) in
            if user != nil {
                print("User Has Sign In")
            }
            if error != nil {
                print(":(",error)
            }
    }
    

提交回复
热议问题