This issue happened to me once and I solved it by adding the Photo Library Usage Description variable to the config.xml and by making an Info.plist with the NSPhotoLibraryUsage. I’ve recently made a new project and I followed the same steps when adding the camera plugin but the error still persists.
My config xml:
<plugin name="cordova-plugin-camera" spec="^3.0.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="..." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="..." />
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data
Read the current documentation of the plugin you are using. The method to add these variables changed.
(Now that you found it, please post it here for future readers. Thanks)
Thank you! I was indeed using the older method to add the variables. For anyone having this same issue:
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need to photo library access to get pictures from there</string>
Just add this in the config.xml
For anyone looking at this : another solution is to add the description text from xCode, in “Info”. That’s just another way to do the same.
… which will get lost every time you recreate your Cordova app. You should really try to minimize messing with the project via Xcode.
To be a little more specific on the @mateuspetter answer which worked for me:
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
<string>Fuelonomy would like to access your photo library for accessing photos of your cars and receipts.</string>
This solution does not work anymore. After adding this on config.xml I start getting this error on
ionic cordova build ios --verbose --debug :
doc.find is not a function
The error disappears after removing the edit-config.
use config-file tag , example :
<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>You can take photos</string>