Custom message when requesting user's permission to Contacts

349 Views Asked by At

I'm using this code to request access to the Contacts UI:

        let store = CNContactStore()
        store.requestAccess(for: .contacts) { (granted, error) in
            if let error = error {
                print(error)
            }
            if granted {
                completionHandler(.granted)
            } else {
                completionHandler(.denied)
            }
        }

But I want to show a custom message in the alert pop up that shows up, detailing why I need to access the user's contacts. How can I do that?

1

There are 1 best solutions below

2
On BEST ANSWER

Go into your Info.plist file, add the following key NSContactsUsageDescription, and add your custom alert message in the value field.