Any ideas why some CNContacts
come back with EMPTY Phone Numbers?
I keep getting output like this:
"phoneNumbers=(not fetched), emailAddresses=(not fetched),"
So for example, when I'm fetching Contacts from the Simulator's built-in Contacts App, I get mixed results:
"John Appleseed"
does return with its Phone Numbers, but "Kate Bell"
does not - even though she clearly has phone numbers.
Its quite strange cause I'm definitely using CNContactPhoneNumbersKey
in my fetch request.
Here's my code:
let fetchKeys = [ CNContactEmailAddressesKey, CNContactPhoneNumbersKey,
CNContactFormatter.descriptorForRequiredKeysForStyle(.FullName) ]
let contactFetchRequest = CNContactFetchRequest(keysToFetch: fetchKeys)
do {
try self.contactsStore.enumerateContactsWithFetchRequest(contactFetchRequest) {
fetchedContact, stop in
print("fetched Contact is: \n\(fetchedContact.description)")
}
}
As I mentioned, the output reveals that sometimes the fetched Contact comes back with Phone Numbers, and sometimes it does not. Same for emails: sometimes they're returned, sometimes not.
This happens both in the Simulator and when I run this on my iPhone.
Any idea what might be happening here?