When I try and load upload my iTunes app installer to iTunes I relieve this error:
Missing Info.plist key - This app attempts to access privacy-sensitive
Please open your project in xcode and go to your .plist file in resources folder,
Then at end of in you .plist file click on "+" and add search for "Privacy - Photo Library Usage Description" and add it's value in beside column.
same please do for "NSCameraUsageDescription" again click on "+" and search for "Privacy - Camera Usage Description" and again give some usage description in beside column.
it will solve you issue.
For more info please visit following:
1) Stackoverflow question related to your question 2) Official apple doc for all required keys to be added
Phonegap Build - for anyone using cli-7.0.1 as probably everyone should be now:
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="overwrite">
<string>Used to allow the user to select media to upload to us</string>
</edit-config>
That does NOT go within the tag, simply within the Widget tag like everything else. Change the string to whatever it suitable for you.
Another edit:
Most plugins removed the variables for usage description, so now the way of setting them is using edit-config
tag in the config.xml like this.
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="overwrite">
<string>We are using the Camera for something...</string>
</edit-config>
But not all plugins have been updated yet, so better read the plugin's README.md before. On the core plugins it's in a section called iOS Quirks.
It also needs the cli 7.0.1 or newer, set it in the config.xml like this:
<preference name="phonegap-version" value="cli-8.0.0" />
EDIT:
My old answer no longer works if you have <preference name='phonegap-version' value='cli-7.0.1' />
(or if you don't have any phonegap-version
as it will use it as default)
To set the usage descriptions use the params on the plugin
<plugin name="cordova-plugin-camera">
<param name="CAMERA_USAGE_DESCRIPTION" value="We are using the Camera for something..." />
<param name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="We are using the Photo Library for something..." />
</plugin>
Beware that if you have some plugins with the same usage descriptions and you don't fill them with param tags they might be replaced with the default empty string
You can force to use the old builder with this tag, but it's not recommended, the new builder is better
<preference name='pgb-builder-version' value='1' />
OLD ANSWER:
You can write in the info.plist like this:
<gap:config-file platform="ios" parent="NSCameraUsageDescription" overwrite="true">
<string>We are using the Camera for something...</string>
</gap:config-file>
The overwrite="true"
is important because latest version of the camera plugin is already writing empty values.
I have tested it on a sample app and it's working https://github.com/jcesarmobile/phonegap-template-hello-world/blob/454e852955e66470890cba636450abd422f50598/config.xml#L153-L155
Before you access privacy-sensitive data like Camera, Contacts, and so on, you must ask for the authorization, your app will crash when you access them.Then Xcode will log like:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
How to deal with this? As apple say:
You must statically declare your app’s intended use of protected data classes by including the appropriate purpose string keys in your Info.plist file.
In your case you may have to add the following in your info.plist,
<!--
None of the answers here worked for me exactly so I figure I should add my two cents as to how I got this working.
First, I tried the accepted answer (the one written by jcesarmobile). When i tried this and ran: phonegap build ios everytime the configuration was deleted from my config.xml file. So next I tried the solution indicated here:
http://geeklearning.io/how-to-add-specific-configuration-parameters-to-ios-p-list-and-android-manifest/
This did not work at first, There were a number of changes that had to be made, all of which I got from the github repo comments on the file. I suggest you run the build, copy the error message and search in the comments and do what they say. Once I got it to build again, It still did not work upon uploading the itunes connect.
In the end I had to open up the Info.plist file and manually put in the following
<key>NSCameraUsageDescription</key>
<string>We are using the Camera to (blah blah blah, your explanation)</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We are using the Photo Library to (your reason)</string>
<key>NSMainNibFile</key>
Even though the hook did not do exactly as it claimed I still think it was important because before I did this everything was getting deleted, and now it stays put.
I hope this helps someone out.
In ios you need to install camera-plugin
with barcodescanner-plugin
after you have to put below line in config.xml
for overwriting plist
file.
<gap:plugin name="phonegap-plugin-barcodescanner" source="npm" />
<preference name="android-build-tool" value="gradle" />
<config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription">
<string>It is used for scaning QR code.</string>
</config-file>
<edit-config platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription" mode="merge">
<string>It is used for scaning QR code.</string>
</edit-config>
<config-file platform="ios" target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>It is used for scanning QR code</string>
</config-file>
<edit-config platform="ios" target="*-Info.plist" parent="NSPhotoLibraryUsageDescription" mode="merge">
<string>It is used for scanning QR code</string>
</edit-config>