I think the error is coming from here but I don't know what is my problem
//validate the fields
let error = validateField()
if error != nil{
// there is something wrong with the fields, show error message
showError(error!)
}
else{
//create celaned versions of the data
let first_name = firstNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let last_name = lastNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let email = emailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let password = passwordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
//create users
Auth.auth().createUser(withEmail: email, password: password) { (result, err) in
//check for errors
if err != nil {
//there was an error creating users
self.showError("Error creating user")
}
else{
//user create successfully, now store f and l name
let db = Firestore.firestore()
db.collection("users").addDocument(data: ["first_name":first_name, "last_name":last_name, "uid": result!.user.uid]) {(error) in
if error != nil {
//show error message
self.showError("User name couldn't be save in database")
}
}
//transition to home screen
self.transtionToHome()
}
}
}
}
**and here is the error message:
```libsystem_kernel.dylib`__pthread_kill:**
0x7fff70173004 <+0>: movl $0x2000148, %eax ; imm = 0x2000148
0x7fff70173009 <+5>: movq %rcx, %r10
0x7fff7017300c <+8>: syscall
-> 0x7fff7017300e <+10>: jae 0x7fff70173018 ; <+20> Thread 14: "-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x6000005ad8f0"
0x7fff70173010 <+12>: movq %rax, %rdi
0x7fff70173013 <+15>: jmp 0x7fff7016d1c5 ; cerror_nocancel
0x7fff70173018 <+20>: retq
0x7fff70173019 <+21>: nop
0x7fff7017301a <+22>: nop
0x7fff7017301b <+23>: nop
If you do not find the line, add some print statements in places, to see where it crashes:
// validate the fields
let error = validateField()
print("#0")
if error != nil{
// there is something wrong with the fields, show error message
showError(error!)
} else {
//create celaned versions of the data
let first_name = firstNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let last_name = lastNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let email = emailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
let password = passwordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)
// create users
print("#1")
Auth.auth().createUser(withEmail: email, password: password) { (result, err) in
print("#2")
// check for errors
if err != nil {
// there was an error creating users
print("#3")
self.showError("Error creating user")
} else {
// user create successfully, now store f and l name
print("#4")
let db = Firestore.firestore()
print("#5")
db.collection("users").addDocument(data: ["first_name":first_name, "last_name":last_name, "uid": result!.user.uid]) {(error) in
if error != nil {
//show error message
print("#6")
self.showError("User name couldn't be save in database")
}
}
// transition to home screen
print("#7")
self.transtionToHome()
print("#8")
}
}
}
}
And show exactly what you get in console log.
and when i click Sign Up button it doesn't do anything now :( it used to will go to next screen
Where is this signIn in your code ?
Please show all the needed code. Crash may not come from what you show.