Firebase authentication

I mirrored this code exactly and I am trying to sign in. After a very tedious process I can tap sign up, go to the sign up page and type in all the fields. However, once I tap sign up nothing happens.

It seems like the app is not communicating with firebase at that point because no UID is being generated in the firebase database.

It seems like a lot, but without knowing too much about coding, it is the best way I can explain what I am experiencing.

I am assuming that you are at the point where you created your Firebase instance similar to what Chris did starting at 31:40 in the tutorial and having completed that process you can see your project in the Firebase console like this (for example).

You might have named it differently but that does not matter.

  • Did you download the GoogleServices-Info.plist file and add that to your project? Ensure that the name of that file is exactly: GoogleServices-Info.plist
  • Was the pod installation successful?
  • Make sure that after the pods installation, you open the project by opening YourProjectName.xcworkspace rather than YourProjectName.xcodeproj (38:52 in the tutorial)
  • In AppDelegate have you included the import Firebase instruction at the top of the file either above or below import UIKit? (either above or below is fine)
  • Have you added the line FirebaseApp.configure() inside the didFinishLaunchingWithOptions method?

Yes the process is tedious setting up authentication but that’s to be expected and most applications using an external database have an equivalent Authentication process but the implementation may vary from one to the other.

maybe this can help you
https://codecrew.codewithchris.com/t/module-3-lesson-3-login-screen-blank/3864/3

It says the link is private or doesnt exist.

I double checked everything and it all checks out correctly. I still have the same issue.

Now I am getting this after I click command+R

Thread 1: Exception: “-[LitorSplit_1.SignUpViewController SignUpTapped:]: unrecognized selector sent to instance 0x7ffa2f70f300”

Can you post your code for that SignUpViewController?

That was in the app delegate

import UIKit
import FirebaseAuth
import Firebase

class SignUpViewController: UIViewController {

@IBOutlet weak var FirstNameTextField: UITextField!


@IBOutlet weak var LastNameTextField: UITextField!


@IBOutlet weak var EmailTextField: UITextField!


@IBOutlet weak var PasswordTextField: UITextField!


@IBOutlet weak var SignUpButton: UIButton!


@IBOutlet weak var ErrorLabel: UILabel!


override func viewDidLoad() {
    super.viewDidLoad()

// Do any additional setup after loading the view.
setUpElements()
}

func setUpElements() {

    // Hide the error label
    ErrorLabel.alpha = 0

    // Style the elements
    Utilities.styleTextField(FirstNameTextField)
    Utilities.styleTextField(LastNameTextField)
    Utilities.styleTextField(EmailTextField)
    Utilities.styleTextField(PasswordTextField)
    Utilities.styleFilledButton(SignUpButton)
}

// Check the fields and validate that the data is correct. If everything is correct, this method returns nil. Otherwise, it returns the error message
func validateFields() -> String? {
    
    // Check that all fields are filled in
    if FirstNameTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) == "" ||
        LastNameTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) == "" ||
        EmailTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) == "" ||
        PasswordTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) == "" {
        
        return "Please fill in all fields."
    }
    
    // Check if the password is secure
    let cleanedPassword = PasswordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
    
    if Utilities.isPasswordValid(cleanedPassword) == false {
        // Password isn't secure enough
        return "Please make sure your password is at least 8 characters, contains a special character and a number."
    }
    
    return nil
}


@IBAction func signUpTapped(_ sender: Any) {
    
    // Validate the fields
    let error = validateFields()
    
    if error != nil {
        
        // There's something wrong with the fields, show error message
        showError(error!)
    }
    else {
        
        // Create cleaned versions of the data
        let firstName = FirstNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
        let lastName = LastNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
        let email = EmailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
        let password = PasswordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
        
        // Create the user
        Auth.auth().createUser(withEmail: email, password: password) { (result, err) in
            
            // Check for errors
            if err != nil {
                
                // There was an error creating the user
                self.showError("Error creating user")
            }
            else {
                
                // User was created successfully, now store the first name and last name
                let db = Firestore.firestore()
                
                db.collection("users").addDocument(data: ["firstname":firstName, "lastname":lastName, "uid": result!.user.uid ]) { (error) in
                    
                    if error != nil {
                        // Show error message
                        self.showError("Error saving user data")
                    }
                }
                
                // Transition to the home screen
                self.transitionToHome()
            }
            
        }
        
        
        
    }
}

func showError(_ message:String) {
    
    ErrorLabel.text = message
    ErrorLabel.alpha = 1
}

func transitionToHome() {
    
    let HomeViewController = storyboard?.instantiateViewController(identifier: constants.Storyboard.HomeViewController) as? HomeViewController
    
    view.window?.rootViewController = HomeViewController
    view.window?.makeKeyAndVisible()

Hello, I am having the same issue as you. Did you figure it out?