Contents

CNContactStore

The object that fetches and saves contacts, groups, and containers from the user’s Contacts database.

Declaration

class CNContactStore

Mentioned in

Overview

The CNContactStore object represents the user’s contacts store database, and you use it to fetch information from that database and save changes back to it. There are a few recommended ways you can implement fetch and save requests in your app:

  • Fetch only the properties that you need for contacts.

  • When fetching all contacts and caching the results, first fetch all contacts identifiers, then fetch batches of detailed contacts by identifiers as required.

  • To aggregate several contacts fetches, first collect a set of unique identifiers from the fetches. Then fetch batches of detailed contacts by those unique identifiers.

  • If you cache the fetched contacts, groups, or containers, you need to refetch these objects (and release the old cached objects) when CNContactStoreDidChange is posted.

Because CNContactStore fetch methods perform I/O, it’s recommended that you avoid using the main thread to execute fetches.

Topics

Requesting access to the user’s contacts

Fetching contacts

Fetching groups and containers

Fetching change history info

Saving changes

Responding to contact store changes

See Also

Essentials