Swift 3 / Xcode 8 - CNContact [access] <Private>
My code crashes as soon as it tries to request access to CNContactStore . Any ideas if this is a beta strong> problem ?
var addressBookStore = CNContactStore() addressBookStore.requestAccess(for: .contacts) { (granted, error) in
// This console message is triggered on failure - Messenger [836: 1175155] [access] private
An accident occurs on this line and even prevents even printing errors!
Thanks in advance
As suggested here: https://developer.apple.com/reference/contacts
Attention!
An iOS application associated with or after iOS 10.0 should include in its Info.plist enter the keys for the description of the use for the types of data that are needed to access, or it will work. To access contact data, it must include NSContactsUsageDescription.
You need to add the NSContactsUsageDescription key to the Info.plist file
Then you will get an authorization dialog. Without this key application, crashes.
let addressBookStore = CNContactStore() addressBookStore.requestAccess(for: CNEntityType.contacts) { (isGranted, error) in print(isGranted) print(error) } 
