IOS: choosing CNContact using id?

I'm having trouble returning CNContactusing id. I used to list all contacts and do something with phone numbers, storing identifiers in an array.

Later, I would like to get a specific contact using one of the saved identifiers, using the following (where currentIdentifieris the identifier that I saved earlier):

CNContact *currentContact = [[CNContact alloc] init];
currentContact = [self.contactStore unifiedContactWithIdentifier:currentIdentifier keysToFetch:@[[CNContactFormatter descriptorForRequiredKeysForStyle:CNContactFormatterStyleFullName]] error:&error];

However, I keep getting NULLit when I load it.

+4
source share

Source: https://habr.com/ru/post/1613564/


All Articles