Contacts Authorization
The ContactsManager SDK requires permission to access the user’s device contacts. This guide explains how to request and manage contacts access in your app.Authorization Status
Check the current authorization status using thecontactsAccessStatus
property:
Requesting Access
Request access to contacts with therequestContactsAccess()
method:
Best Practices for Requesting Access
- Explain Why: Before requesting access, explain to users why your app needs contacts access
- Request at the Right Time: Only request access when you actually need it
- Handle Denial Gracefully: Provide a way for users to enable access later if they initially deny it
Handling Access Denial
When access is denied, the SDK provides a SwiftUI alert that guides users to the Settings app:Privacy Configuration
In addition to requesting permission at runtime, you must configure your app’sInfo.plist
file with a privacy description:
Complete Authorization Flow Example
Here’s a complete example showing the authorization flow:Troubleshooting
Common Issues
-
Permission Dialog Not Showing
- Verify that you’ve added the
NSContactsUsageDescription
key to your Info.plist - Make sure you’re calling
requestContactsAccess()
on the main thread
- Verify that you’ve added the
-
Permission Denied
- Use the settings alert to guide users to enable access in Settings
- Explain the benefits of contacts access clearly
-
Sync Failing After Permission Granted
- Make sure the SDK is properly initialized
- Check for network connectivity issues
- Verify that you’ve registered the contact source