Instance Method

unifiedContact(withIdentifier:keysToFetch:)

Fetches a unified contact for the specified contact identifier.

Declaration

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

Parameters

identifier

The identifier of the contact to fetch.

keys

The properties to fetch in the returned CNContact object.

error

Error information, if an error occurred.

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:). It is recommended to fetch only the properties that will be used. You can combine contact keys and contact key descriptors together.

See Also

Fetching Contacts

func enumerateContacts(with: CNContactFetchRequest, usingBlock: (CNContact, UnsafeMutablePointer<ObjCBool>) -> Void)

Returns a Boolean value that indicates whether the enumeration of all contacts matching a contact fetch request executed successfully.

func unifiedMeContactWithKeys(toFetch: [CNKeyDescriptor]) -> CNContact

Fetches the unified contact that is the "me" card.

func unifiedContacts(matching: NSPredicate, keysToFetch: [CNKeyDescriptor]) -> [CNContact]

Fetches all unified contacts matching the specified predicate.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software