TechnologiesCommunication, Contacts & Messaging

Contacts

iOSmacOStvOSwatchOSvisionOS

Contacts provides access to the user's contacts database on iOS, macOS, watchOS, and visionOS, letting your app fetch, format, and manage contact records and the groups that organize them. You request access through CNContactStore subject to CNAuthorizationStatus, then read or modify records using CNContact and its mutable counterpart CNMutableContact, retrieve them with CNContactFetchRequest, and arrange them with CNGroup and CNContainer. Use CNContactFormatter to render display names, CNLabeledValue to attach labeled fields such as CNInstantMessageAddress or CNMutablePostalAddress, and CNContactVCardSerialization to import and export vCard data. To track edits over time, fetch change history with CNChangeHistoryFetchRequest and process the resulting events, including CNChangeHistoryAddContactEvent and CNChangeHistoryUpdateGroupEvent, through a CNChangeHistoryEventVisitor.

Essentials 3

The store you use to request access to and fetch records from the user's contacts database.

  • Cl
    CNContactStoreiOS 9.0+
    @abstract Provides methods to fetch and save contacts.
  • En
    CNAuthorizationStatusiOS 9.0+
    @abstract The authorization the user has given the application to access an entity type.
  • En
    CNEntityTypeiOS 9.0+
    @abstract The entities the user can grant access to.

Contacts 3

The immutable and mutable record types that represent individual people and organizations.

  • Cl
    CNContactiOS 9.0+
    @abstract An immutable value object representing a contact.
  • Cl
    CNMutableContactiOS 9.0+
    @abstract A mutable value object representing a contact.
  • En
    CNContactTypeiOS 9.0+
    Constants that indicate whether a contact represents a person or an organization.

Contact Properties 9

The labeled fields and value types that make up a contact's information.

  • Cl
    CNLabeledValueiOS 9.0+
    @abstract A contact property that has a value and label.
  • Cl
    CNContactPropertyiOS 9.0+
    @abstract Contains related information for a specific contact property.
  • Cl
    CNContactRelationiOS 9.0+
    @abstract An immutable value object representing a related contact.
  • Cl
    CNPhoneNumberiOS 9.0+
    @abstract An immutable value object representing a phone number.
  • Cl
    CNPostalAddressiOS 9.0+
    @abstract An immutable value object representing a postal address.
  • Cl
    CNMutablePostalAddressiOS 9.0+
    @abstract A mutable value object representing a postal address.
  • Cl
    CNInstantMessageAddressiOS 9.0+
    @abstract An immutable value object representing an instant message address.
  • Cl
    CNSocialProfileiOS 9.0+
    @abstract An immutable value object representing a social profile.
  • Pr
    CNKeyDescriptor
    This protocol is reserved for Contacts framework usage.

Groups and Containers 4

The collections that organize contacts into groups and account-backed containers.

  • Cl
    CNGroupiOS 9.0+
    @abstract An immutable value object representing a group.
  • Cl
    CNMutableGroupiOS 9.0+
    @abstract A mutable value object representing a group.
  • Cl
    CNContaineriOS 9.0+
    @abstract An immutable value object representing a container.
  • En
    CNContainerTypeiOS 9.0+
    Constants that identify the type of account a container belongs to, such as local or CardDAV.

Fetching and Saving 5

The requests and results you use to read records from and commit changes to the contacts database.

  • Cl
    CNFetchRequestiOS 9.0+
    The abstract base class for requests that fetch records from the contacts database.
  • Cl
    CNContactFetchRequestiOS 9.0+
    @abstract Specifies the search criteria to fetch contacts.
  • Cl
    CNFetchResultiOS 13.0+
    An object that holds the results of a fetch request, including a token for tracking changes.
  • Cl
    CNSaveRequestiOS 9+
    @abstract Specifies the changes to save.
  • En
    CNContactSortOrderiOS 9.0+
    @abstract Sort order for contacts.

Formatting Names and Addresses 6

The formatters and styles that render contact display names and postal addresses.

  • Cl
    CNContactFormatteriOS 9.0+
    @abstract Formats a contact name.
  • En
    CNContactFormatterStyleiOS 9.0+
    @abstract The formatting styles for contact names.
  • En
    CNContactDisplayNameOrderiOS 9.0+
    @abstract The formatting order of the contact name components.
  • Cl
    CNPostalAddressFormatteriOS 9.0+
    @abstract Formats a postal address.
  • En
    CNPostalAddressFormatterStyleiOS 9.0+
    @abstract The formatting styles for postal addresses.
  • Cl
    CNContactsUserDefaultsiOS 9.0+
    @abstract The user defaults for contacts.

vCard Serialization 1

The serialization support for importing and exporting contacts as vCard data.

  • Cl
    CNContactVCardSerializationiOS 9.0+
    @abstract Contact vCard support.

Change History 14

The request, events, and visitor you use to track additions, updates, and deletions over time.

  • Cl
    CNChangeHistoryFetchRequestiOS 13.0+
    @abstract Specifies the criteria to fetch change history.
  • Cl
    CNChangeHistoryEventiOS 13.0+
    The abstract base class for events that describe a change in the contacts database history.
  • Pr
    CNChangeHistoryEventVisitoriOS 13.0+
    A protocol that processes change history events as they are enumerated.
  • Cl
    CNChangeHistoryDropEverythingEventiOS 13.0+
    Drop all cached information your app has persisted
  • Cl
    CNChangeHistoryAddContactEventiOS 13.0+
    A contact was added
  • Cl
    CNChangeHistoryUpdateContactEventiOS 13.0+
    A contact was updated
  • Cl
    CNChangeHistoryDeleteContactEventiOS 13.0+
    A contact was removed
  • Cl
    CNChangeHistoryAddGroupEventiOS 13.0+
    A group was added
  • Cl
    CNChangeHistoryUpdateGroupEventiOS 13.0+
    A group was updated
  • Cl
    CNChangeHistoryDeleteGroupEventiOS 13.0+
    A group was deleted
  • Cl
    CNChangeHistoryAddMemberToGroupEventiOS 13.0+
    A contact was added to a group
  • Cl
    CNChangeHistoryRemoveMemberFromGroupEventiOS 13.0+
    A contact was removed from a group
  • Cl
    CNChangeHistoryAddSubgroupToGroupEventiOS 13.0+
    A subgroup was added to a group
  • Cl
    CNChangeHistoryRemoveSubgroupFromGroupEventiOS 13.0+
    A subgroup was removed from a group

Errors 1

The error type reported by Contacts operations.

  • St
    CNErroriOS 9.0+
    A structure that describes errors reported by Contacts framework operations.

Extends 2

NSStringNSNotification
← Communication, Contacts & Messaging