Pavel Kovalev Pavel Kovalev - 1 month ago 30
iOS Question

Cordova Info.plist NSCameraUsageDescription key is missing

After recent changes Apple requires specific keys if your app attempts to access privacy-sensitive data. So I added NSCameraUsageDescription key in my config.xml like this:

<platform name="ios">
<config-file parent="NSCameraUsageDescription" target="*-Info.plist">
<string>We are using a camera to </string>
</config-file>
</platform>


Then

cordova build ios --release --device


produces the ipa which apparently doesn't have the right info in info.plist. It feels like I'm missing something.

Question 1:
What do I need to put into config.xml to solve NSCameraUsageDescription issue?
Question 2:
Is it possible to use localization for this string?

Thank you!

Answer

Here are results of my own research:

    • Yes, you can modify info.plist from the config.xml file using the config-file tag, but you have to use a plugin for that (cordova custom config) and follow the instructions religiously.
    • However, probably a better option is to use plugin.xml to do the same thing. More about it you can read here (modifying info plist from plugin.xml)
    • Another option as @jcesarmobile mentioned - current camera plugin may support it like cordova plugin camera (this solution is specific to the plugin)

Please, correct me if I wrong. More info on the localization directly from config.xml is appreciated.

Personally, I don't like the idea to use a custom plugin to modify an info.plist file. It feels like with every new plugin I use make my app more and more fragile. :)

Comments