---
title: CNContactStore
framework: contacts
role: symbol
role_heading: Class
path: contacts/cncontactstore
---

# CNContactStore

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

## Declaration

```swift
class CNContactStore
```

## Mentioned in

Accessing the contact store

## Overview

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

- [requestAccess(for:completionHandler:)](contacts/cncontactstore/requestaccess(for:completionhandler:).md)
- [authorizationStatus(for:)](contacts/cncontactstore/authorizationstatus(for:).md)
- [CNAuthorizationStatus](contacts/cnauthorizationstatus.md)
- [CNEntityType](contacts/cnentitytype.md)

### Fetching contacts

- [enumerateContacts(with:usingBlock:)](contacts/cncontactstore/enumeratecontacts(with:usingblock:).md)
- [unifiedMeContactWithKeys(toFetch:)](contacts/cncontactstore/unifiedmecontactwithkeys(tofetch:).md)
- [unifiedContact(withIdentifier:keysToFetch:)](contacts/cncontactstore/unifiedcontact(withidentifier:keystofetch:).md)
- [unifiedContacts(matching:keysToFetch:)](contacts/cncontactstore/unifiedcontacts(matching:keystofetch:).md)

### Fetching groups and containers

- [defaultContainerIdentifier()](contacts/cncontactstore/defaultcontaineridentifier().md)
- [groups(matching:)](contacts/cncontactstore/groups(matching:).md)
- [containers(matching:)](contacts/cncontactstore/containers(matching:).md)

### Fetching change history info

- [currentHistoryToken](contacts/cncontactstore/currenthistorytoken.md)

### Saving changes

- [execute(_:)](contacts/cncontactstore/execute(_:).md)

### Responding to contact store changes

- [CNContactStoreDidChange](foundation/nsnotification/name-swift.struct/cncontactstoredidchange.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Essentials

- [Accessing the contact store](contacts/accessing-the-contact-store.md)
- [Accessing a person’s contact data using Contacts and ContactsUI](contacts/accessing-a-person-s-contact-data-using-contacts-and-contactsui.md)
- [NSContactsUsageDescription](bundleresources/information-property-list/nscontactsusagedescription.md)
- [com.apple.developer.contacts.notes](bundleresources/entitlements/com.apple.developer.contacts.notes.md)
