I have Firebase phone auth in my app. However, when the user doesn't input a phone number. It doesn't give an error to put a phone number the app just crashes. This is the code that I have:
@IBAction func sendPhoneAuthCode(_ sender: Any){
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber.text!, uiDelegate: nil) { (verificationID, error) in
if let error = error {
print(error as Any)
return
}
// Sign in using the verificationID and the code sent to the user
// ...
}
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
}