I have a KMM project (and am working in the Shared>iOSMain module), and need to read the device contacts, and send phone numbers back to a server in E164 format (actually the number is hashed before being sent back, but it must be in E164 prior to the hashing).
I have this working fine on the Android side, and am reading the contacts on the iOS side, but my problem is that all I can get from iOS is CNPhoneNumber.stringValue
which is a formatted phone number like (888) 555 5512
, and not E164 (+18885555512
).
I cant find any easy way to convert this to E164, as the stringValue may or may not have country code in it, and there's no way to tell (and this needs to work globally).
Surely getting phone numbers from contacts into the international standard must be straight forwards - what am I missing?