chronotruck / FlagPhoneNumber

A formatted phone number UITextField with country flag picker.
Apache License 2.0
437 stars 317 forks source link

Bad access after upgrade #127

Open gigallo opened 5 years ago

gigallo commented 5 years ago

Describe the bug Inserting number and checking it a bad access error is thrown

extension PairingViewController: FPNTextFieldDelegate {

func fpnDidSelectCountry(name: String, dialCode: String, code: String) {

}

func fpnDidValidatePhoneNumber(textField: FPNTextField, isValid: Bool) {

    if (isValid) {

        mobileNumber = textField.getFormattedPhoneNumber(format: .International)!.replacingOccurrences(of: " ", with: "")  <----- error thrown here

    } else {
        mobileNumber = nil;
    }

}

}

To Reproduce Steps to reproduce the behavior: 1) insert +393493184264

Expected behavior Phone number is accepted

Screenshots

Smartphone (please complete the following information): iOS 13.1 iPhone x

FlagPhoneNumber (please complete the following information):

Additional context Add any other context about the problem here.

Salman-Majid commented 5 years ago

I am getting the bad access error after upgrading as well. What can i do? i don't even have to enter my phone number. It just crashes when i load the screen where FPNTextField is added.