Requests access to the user's contacts.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- watchOS 2.0+
Set granted to
YESif the user allows access and error is
Users grant or deny access to contact data on a per-app basis. Request access to contact data by calling the
request 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
completion on an arbitrary queue. It is recommended that you use
CNContact instance methods in this completion handler instead of the UI main thread. This method is optional when
CNContact is used in the background thread. If you don't request access,
CNContact may block your app while asking the user for access.