0

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?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Rod
  • 424
  • 2
  • 7
  • 17

1 Answers1

1

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

trndjc
  • 11,654
  • 3
  • 38
  • 51
  • 1
    I found a key called "Privacy - Contacts Usage Description" in plist, that's what I needed to change to make the text appear. Thanks! – Rod Mar 16 '18 at 17:50
  • @Rod that's the `NSContactsUsageDescription` key--the property list automatically converts it into something more readable when you add it – trndjc Mar 16 '18 at 17:53