Expo app showing incorrect countryCode for most contacts

I’m on SDK 39.0 with expo-contacts version 8.6.0.

On iOS Expo app (not simulator), the contacts from my phone are showing 95% of the time with a countryCode value of “md”, the country I am currently in. The country code was not set for most of these numbers and if they were set, then it would be set for “us”.

Here are some examples of the output I get right after I call “getContactsAsync”.

    const f = Contacts.Fields;
    let { data: contactsFromDevice } = await Contacts.getContactsAsync({
        fields: [f.ID, f.Name, f.PhoneNumbers, f.ImageAvailable],
      });

 Object {
    "contactType": "person",
    "firstName": "Vik",
    "id": "D417FAF1-BFE3-429B-919C-DEAD3FF50BD3",
    "imageAvailable": false,
    "name": "Vik",
    "phoneNumbers": Array [
      Object {
        "countryCode": "md",
        "digits": "4081234567",
        "id": "9F710168-8243-4D4D-9A2A-F6C095E2BC24",
        "label": "mobile",
        "number": "4081234567",
      },
    ],
  },
 Object {
    "contactType": "person",
    "firstName": "Alison",
    "id": "2C5AB54F-D3CD-4376-A9AD-37733435341445",
    "imageAvailable": false,
    "name": "Alison",
    "phoneNumbers": Array [
      Object {
        "countryCode": "md",
        "digits": "14081234567",
        "id": "7122CD6A-38ED-48A9-883C-36FBBFGKJH4EF7",
        "label": "mobile",
        "number": "14081234657",
      },
    ],
  },

In summary:

  • Expo in Simulator: Works fine
  • Expo on Android: Works fine
  • Expo on iOS: Broken

I can’t really test easily on standalone iOS because of the OTA release-channel issue in SDK 39.

Has anyone ever seen an issue like this?

Well, you are in luck. The release channel issue (amongst others) has apparently been fixed now.

Yeah, just saw, Christmas came early this year. :wink:

I’m going to get that up to TestFlight and see if it still happens on my phone…could be because I’m syncing from Google and haven’t seen it before…so maybe something on my end…will update this thread shortly…

2 Likes

@wodin - I still have this issue, even on my Testflight version.

I’ve narrowed it down a little though, so:

  1. If I unsync Contacts from iCloud, and add an American number, it will work and not get the countryCode as being my current location.
  2. If I sync with iCloud and add that same American number, it will return “md” as the country code.

Has anyone testing syncing contacts with iCloud contacts and verified the country code?

Sorry, I don’t have iCloud and while working from home I don’t have access to an IOS device.

Can anybody confirm if they are using Contact syncing and have not encountered problems with the countryCode on contacts imported from iCloud?

It might be best to create an issue on GitHub with the steps to reproduce this and the extra info you’ve posted here.

Let’s close this for now as I think it could just be my icloud account being screwed up with the country code…I haven’t seen it with my users app. I will reopen if it becomes an issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.