Update 22.09.2017: I wrote a plugin for cordova/ionic which simplifies the process: iOS 10/11 camera permission description plugin
I just wanted to share this little finding with you, which I encountered today trying to upload our App update for iOS 10 of “zingoo Partner App” to Testflight. The app got rejected from Testflight because of a missing NSCameraUsageDescription.
Read on for an easy three step solution:
Our Ionic app makes use of the internal camera to scan barcodes and QR codes on vouchers we sell. Since iOS 10, Xcode urges app developers to provide a reason (NSCameraUsageDescription), why your app needs the permission to access the camera or photo library. While you can still build the app and upload it to the app store, it will be rejected with the following mail:
[…] This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data. […]
The issue: NSCameraUsageDescription
Xcode 8 asks you to provide a key/value pair for NSCameraUsageDescription info.plist.
So if your Ionic/Cordova App uses the camera or photos library and you already got the same rejection mail when you uploaded the newest build, here’s the 3-steps solution:
1. Remove the “offending” plugin
We will re-install it later, but first we have to remove the plugin. In our app the phonegap-plugin-barcodescanner plugin caused the problem (you can always get a full list of all installed plugins with the command
cordova plugin list).
Open your console (CMD on Windows, Terminal on OS X), right-click-paste the following line and hit enter:
cordova plugin rm phonegap-plugin-barcodescanner
The command tells cordova to remove the plugin “phonegap-plugin-barcodescanner” from all of your installed platforms.
2. Re-add the cordova plugin again
Now, re-add the plugin, this time with the attached variable CAMERA_USAGE_DESCRIPTION. If you want to install a specific version of the plugin, in our example version 4.1.0., attach
@4.1.0 to the plugin name:
Install the latest version:
cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="Scan QR-Codes" --save
OR: Install a specific version
cordova plugin add firstname.lastname@example.org --variable CAMERA_USAGE_DESCRIPTION="Scan QR-Codes" --save
Cordova re-installs the plugin and adds it to all installed plattforms. It will then add a new variable to the config.xml file by the name CAMERA_USAGE_DESCRIPTION and a value with a string of your choice explaining why your app needs camera access:
<plugin name="phonegap-plugin-barcodescanner" spec="~4.1.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Scan QR-Codes" />
3. Re-build your App for iOS
Now run the following code in your Terminal to rebuild your iOS app:
ionic build ios --release
Then open your Apps .xcodeproj-file in Xcode. It’s located under your apps main folder in “platforms/ios/NAME-OF-YOUR-APP/NAME-OF-YOUR-APP.xcodeproj”. Select the “Generic iOS Device”, click “Product > Archive” and upload your error-free Build.