Instance Method


Requests access to the user's contacts.


func requestAccess(for entityType: CNEntityType, completionHandler: @escaping (Bool, Error?) -> Void)



Set to CNEntityTypeContacts.


Set granted to true if the user allows access and error is nil.


Users grant or deny access to contact data on a per-app basis. Request access to contact data by calling the requestAccess(for:completionHandler:) method, which returns right away. The first time your app calls this method, the system prompts the user to grant or deny access to your app. The system then saves the user's response and does not prompt them again.

The system executes completionHandler on an arbitrary queue. It is recommended that you use CNContactStore instance methods in this completion handler instead of the UI main thread. This method is optional when CNContactStore is used in the background thread. If you don't request access, CNContactStore may block your app while asking the user for access.

See Also

Requesting Access to the User's Contacts

class func authorizationStatus(for: CNEntityType) -> CNAuthorizationStatus

Returns the current authorization status to access the contact data.

enum CNAuthorizationStatus

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

enum CNEntityType

The entities the user can grant access to.

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