<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Contacts",
  "identifier" : "/documentation/Contacts/CNContactStore",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Contacts"
    ],
    "preciseIdentifier" : "c:objc(cs)CNContactStore"
  },
  "title" : "CNContactStore"
}
-->

# CNContactStore

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

```
class CNContactStore
```

## 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 <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/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

[`-  requestAccessForEntityType:completionHandler:`](/documentation/Contacts/CNContactStore/requestAccess(for:completionHandler:))

Requests access to the user’s contacts.

[`+  authorizationStatusForEntityType:`](/documentation/Contacts/CNContactStore/authorizationStatus(for:))

Returns the current authorization status to access the contact data.

[`CNAuthorizationStatus`](/documentation/Contacts/CNAuthorizationStatus)

An authorization status the user can grant for an app to access the specified entity type.

[`CNEntityType`](/documentation/Contacts/CNEntityType)

The entities the user can grant access to.

### Fetching contacts

[`-  enumerateContactsWithFetchRequest:error:usingBlock:`](/documentation/Contacts/CNContactStore/enumerateContacts(with:usingBlock:))

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

[`-  unifiedMeContactWithKeysToFetch:error:`](/documentation/Contacts/CNContactStore/unifiedMeContactWithKeys(toFetch:))

Fetches the unified contact that’s the *me* card.

[`-  unifiedContactWithIdentifier:keysToFetch:error:`](/documentation/Contacts/CNContactStore/unifiedContact(withIdentifier:keysToFetch:))

Fetches a unified contact for the specified contact identifier.

[`-  unifiedContactsMatchingPredicate:keysToFetch:error:`](/documentation/Contacts/CNContactStore/unifiedContacts(matching:keysToFetch:))

Fetches all unified contacts matching the specified predicate.

[`-  enumeratorForContactFetchRequest:error:`](/documentation/Contacts/CNContactStore/enumeratorForContactFetchRequest:error:)

Enumerates a contact fetch request.

### Fetching groups and containers

[`-  defaultContainerIdentifier`](/documentation/Contacts/CNContactStore/defaultContainerIdentifier())

Returns the identifier of the default container.

[`-  groupsMatchingPredicate:error:`](/documentation/Contacts/CNContactStore/groups(matching:))

Fetches all groups matching the specified predicate.

[`-  containersMatchingPredicate:error:`](/documentation/Contacts/CNContactStore/containers(matching:))

Fetches all containers matching the specified predicate.

### Fetching change history info

[`-  enumeratorForChangeHistoryFetchRequest:error:`](/documentation/Contacts/CNContactStore/enumeratorForChangeHistoryFetchRequest:error:)

Enumerates a change history fetch request.

[`currentHistoryToken`](/documentation/Contacts/CNContactStore/currentHistoryToken)

The current history token.

### Saving changes

[`-  executeSaveRequest:error:`](/documentation/Contacts/CNContactStore/execute(_:))

Executes a save request and returns success or failure.

### Responding to contact store changes

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/CNContactStoreDidChange>

[`CNContactStoreDidChangeNotification`](/documentation/Contacts/CNContactStoreDidChangeNotification)

Posted when changes occur to the contact store.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)