Update 1.2.0 of the cordova camera permissions plugin ships support for NSPhotoLibraryAddUsageDescription in iOS 11
In my last blog post I wrote about the iOS 10 camera permission a.k.a. iOS 10 NSCameraUsageDescription Permission issue, we encountered during the development of our Ionic/Cordova App.
To further automate the npm-based build process, I wrote a simple cordova plugin, which can be installed with the cordova plugin installation routine.
Latest published version on npm (with Cordova CLI >= 5.0.0)
cordova plugin add cordova-plugin-ios-camera-permissions --save
Latest version from GitHub
cordova plugin add https://github.com/Cordobo/cordova-plugin-ios-camera-permissions.git --save
The plugin adds a new key/value pair to your apps *.Info.plist:
<key>NSCameraUsageDescription</key> <string>To scan barcodes</string>
For now, the string is as is – if you want to change the value, you need to overwrite the value in plugin.xml.
For the changes to plugin.xml to take effect, you must refresh the ios.json file (inside the /plugin folder):
cordova platform rm ios cordova platform add ios
If you use the flag
--save like I did in the example code shown above, cordova adds an additional entry to your main config.xml file:
<plugin name="cordova-plugin-ios-camera-permissions" spec="https://github.com/Cordobo/cordova-plugin-ios-camera-permissions.git" />
Get the code: GitHub Repository