edit-config for ios usage descriptions: doc.find is not a function

IosCordova

Ios Problem Overview


When using the edit-config tag in config.xml, I get this error on build:

Error: doc.find is not a function

Any ideas?

Ios Solutions


Solution 1 - Ios

I think that the error has thrown when the platforms/ios/ios.json file is conflicting to the config.xml.

To resolve this issue, remove *-Info.plist key and its value in platforms/ios/ios.json and do cordova prepare ios again.

--- adding 17/May/2020 ---

If some plugins has config-file tag for *-Info.plist and config.xml has edit-config tag for *-Info.plist, this error may happen. In this case, remove platforms/* and plugins/*, and then cordova platform add ios and cordova prepare again. (If you do cordova prepare without cordova platform add ios, this error may happen)

Solution 2 - Ios

There is an existing issue with <edit-config> conflicting with platforms/ios/ios.json when *-Info.plist is already populated in the json file as of Cordova 7.1.0

I have fixed the issue by using <config-file> instead.

Solution:

<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
    <string>need location access to find things nearby</string>
</config-file>

Solution 3 - Ios

I have done this with Ionic 3. Working fine now :)

Solution:

ionic cordova platform remove ios
ionic cordova platform add ios

Re-adding the iOS platform will freshly create the ios.json file.

Solution 4 - Ios

Yes, brute force on this case works just fine

cordova platform rm ios && cordova platform add ios

You shouldn't care what's inside platform/ios because the directory platforms is volatile in cordova, nor should be tracked on git projects.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBenjamin E.View Question on Stackoverflow
Solution 1 - IosKNaitoView Answer on Stackoverflow
Solution 2 - IosShien HongView Answer on Stackoverflow
Solution 3 - IosSampathView Answer on Stackoverflow
Solution 4 - IosJoão Pimentel FerreiraView Answer on Stackoverflow