Contents

unifiedContact(withIdentifier:keysToFetch:)

Fetches a unified contact for the specified contact identifier.

Declaration

func unifiedContact(withIdentifier identifier: String, keysToFetch keys: [any CNKeyDescriptor]) throws -> CNContact

Parameters

  • identifier:

    The identifier of the contact to fetch.

  • keys:

    The properties to fetch in the returned Cncontact object.

Return Value

A unified contact matching or linked to the identifier.

Discussion

Due to unification, the returned contact may have a different identifier than you specify. To fetch a batch of contacts by identifiers, use predicateForContacts(withIdentifiers:) with unifiedContacts(matching:keysToFetch:). Fetch only the properties that your app uses. You can combine contact keys and contact key descriptors together.

To include CNContactNoteKey in the array of keys in iOS, add the com.apple.developer.contacts.notes entitlement to your app. The entitlement requires permission from Apple to use, and you can’t publicly distribute your app until you have permission to use it. For more information about adding the entitlement and getting permission, see com.apple.developer.contacts.notes.

See Also

Fetching contacts