PhoneNumberKit icon indicating copy to clipboard operation
PhoneNumberKit copied to clipboard

Not able to validate Emergency number using PhoneNumberKit

Open NathaSuleSM opened this issue 3 years ago • 1 comments

Hi

I am using pod 'PhoneNumberKit', '~> 3.3'
PhoneNumber is correctly validating with country code. but when I tried below code it gives me error.

    do {
        let emergencyNumber = "+1 911"
        let phoneNumberCustomDefaultRegion = try phoneNumberKit.parse(emergencyNumber, withRegion: "US", ignoreType: false)
    }
    catch {
        print("Generic parser error \(error.localizedDescription)")
    }
    
    **Error** Generic parser error The number provided is invalid.
    
    Any Help will be really appreciated.
    Thanks in Advance. 

NathaSuleSM avatar Aug 10 '22 05:08 NathaSuleSM

Hey @NathaSuleSM, Unfortunately with this project we are relying on the Google metadata, and it seems that this metadata is also marking the emergency number as invalid: https://libphonenumber.appspot.com/phonenumberparser?number=911&country=US.

What I can suggest is to open an issue with the Google guys on this link: https://issuetracker.google.com/issues/new?component=192347&title=Validation+issue+with+911+%28US%29, and we would be happy to update the metadata in this project, when they have a solution for it.

petermolnar-dev avatar Aug 14 '22 20:08 petermolnar-dev

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 14 '22 04:10 github-actions[bot]