Upon updating to iOS 10, when trying to access the contacts through plugin cordova-plugin-contacts v2.2.0, the app exits with
__CRASHING_DUE_TO_PRIVACY_VIOLAT
In short, the usage descriptions need to be specified inside *info.plist
That's no good for Cordova codebase since .plist files are not part of the repository. The simplest way I found to put them inside config.xml is this:
.
<platform name="ios">
<config-file parent="NSContactsUsageDescription" target="*info.plist">
<string>Easily invite your friends</string>
</config-file>
</platform>
For me, I was trying to request access to the microphone, but I hadn't defined the Privacy - Microphone Usage Description
string.
Go into your Info.plist file, and scroll down to the values that start with Privacy
. Make sure you add keys and string values for everything relevant to your app.
My Info.plist was missing NSPhotoLibraryAddUsageDescription
. There are now TWO permissions associated with the photo library (starting iOS 11):
I had the first permission prior to iOS 11 when it was the only key needed to use the photo library. Apparently in iOS 11 they added the second and made it required to add photos to the library. So if you support iOS 10 but don't include the second key, you will crash on iOS 11.
All Keys are Here
If you are clear the issue is when accessing Contacts, then follow instructions posted on above answers.
But if those didn't help you, you may want to read my related answer here on other possible solutions (if you are using Bluetooth on your app): https://stackoverflow.com/a/60073667/457202
My app was missing NSFaceIDUsageDescription key
After creating an Xcode project and finding the Info.Plist
file, you may try adding NSContactsUsageDescription
key, which should accept a string value.
A complete list of Cocoa Keys
Hope that helps!
EDIT
A part from the doc: (which can help you understand why it is crashing)
Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses the user’s contacts, must statically declare the intent to do so. Include the NSContactsUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access the user’s contacts without a corresponding purpose string, your app exits.