iOS firestore cannot store data

Hi guys, I am working on the custom sign up and login tutorial. Everything works perfectly fine, except the Firestore. When I tried to store the first name and last name in the Firestore, it didn’t work, but the authentication works, the user can be created, but the data about first name and last name can not be stored in Firestore. I have no idea how to solve this problem, because there isn’t any error shows on the console. Could you please help me to solve this problem, any help will be appreciated!

//create cleaned version of the data
            let firstName = FirstName.text!.trimmingCharacters(in: .whitespacesAndNewlines)
            let lastName = LastName.text!.trimmingCharacters(in: .whitespacesAndNewlines)
            let email = Email.text!.trimmingCharacters(in: .whitespacesAndNewlines)
            let password = Password.text!.trimmingCharacters(in: .whitespacesAndNewlines)
            //create a 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")
                    //user was created successfully, now store the first name and last name
                    let db = Firestore.firestore()
                    db.collection("users").addDocument(data: ["first_name":firstName, "last_name":lastName, "uid":result!.user.uid]) { (error) in

                        if error != nil{
                            self.showError("Error saving user data")
                            print("No error")
                            self.showError("No Error")

hello, is your read/write permission on your database rules set to allow? (try to put in testing mode first)

Hi, I have set them to be true on my Firestore, but it still can’t save any data.

try deleting “if true” and just leave the allow read, write

also make sure you really did put your GoogleService-Info.plist in your project

OK, thank you very much!