[PhoneGap] [DrupalGap] How to resolve "the app's Info.plist must contain an NSPhotoLibraryUsageDescription key" issue

Today we encountered an issue while trying to submit a DrupalGap app to Apple store:

We have discovered one or more issues with your recent delivery for "TheVine | Fresh Showcase". To process your delivery, the following issues must be corrected:
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.

According to brief Internet research, this is a known recently appeared issue of PhoneGap, Ionic, Cordova apps.

Our app uses cordova-plugin-camera, and the plugin page says:

Since iOS 10 it's mandatory to add a NSCameraUsageDescription and NSPhotoLibraryUsageDescription in the info.plist.
NSCameraUsageDescription describes the reason that the app accesses the user’s camera.
NSPhotoLibraryUsageDescription describes the reason the app accesses the user's photo library.

There are special variables that can be used to enter this in config.xml. However, when we tried using this configuration, it didn't work:


<plugin name="cordova-plugin-camera" spec="~2.2.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="The app would like to access the camera when you attach photos to content." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="The app would like to access the photo library when you attach images to content." />
</plugin>

The reason was that these special variables are supported by the plugin version 2.3.0 and higher (we found it in the comments here), so here's the final solution that worked was:


<plugin name="cordova-plugin-camera" spec="~2.3.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="The app would like to access the camera when you attach photos to content." />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="The app would like to access the photo library when you attach images to content." />
</plugin>

Add new comment

By submitting this form, you accept the Mollom privacy policy.