[
https://issues.apache.org/jira/browse/CB-13564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388264#comment-16388264
]
Jacob Weber commented on CB-13564:
----------------------------------
I think this needs the attention of a Cordova developer....the code is pretty
complex, and I don't want to submit a patch without fully understanding it.
The error consistently happens when you try to modify Info.plist in both a
plugin and config.xml.
Here's how to reproduce it. First create a plugin that does an edit-config on
Info.plist:
{code:java}
# /sample-plugin/plugin.xml
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
id="sample-plugin"
version="1.0.0">
<name>Sample</name>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge"
target="NSPhotoLibraryUsageDescription">
<string>foo</string>
</edit-config>
</platform>
</plugin>{code}
{code:java}
# /sample-plugin/package.json
{
"name": "sample-plugin",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}{code}
Then try the following:
{code:java}
$ node --version
v8.9.4
$ cordova --version
8.0.0
$ cordova create CordovaTest com.sample.cordovatest CordovaTest
$ cd CordovaTest
$ cordova platform add [email protected]
$ cordova plugin add /sample-plugin/
$ rm -rf platforms/ node_modules/ plugins/ package-lock.json{code}
Then edit {{config.xml}} and add another edit-config for Info.plist:
{code:java}
<edit-config file="*-Info.plist" mode="merge"
target="NSCameraUsageDescription">
<string>bar</string>
</edit-config>
{code}
Then run:
{code:java}
$ cordova prepare --verbose{code}
The output will end in:
{code:java}
(node:43598) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): TypeError: doc.find is not a function
(node:43598) [DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the future, promise rejections that are not handled will
terminate the Node.js process with a non-zero exit code.{code}
> Multiple edit-config items for Info.plist causing error
> -------------------------------------------------------
>
> Key: CB-13564
> URL: https://issues.apache.org/jira/browse/CB-13564
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-cli
> Reporter: Tom Bell
> Priority: Major
>
> I am on 7.1.0 of `cordova-cli`, there was no `7.1.0` in the "Affects
> Versions" dropdown.
> I've updated `cordova-ios` to 4.5.3 and `cordova-plugin-contacts` to 3..0.0,
> I've got the following
> working:
> {code:xml}
> <edit-config file="*-Info.plist" mode="merge"
> target="NSContactsUsageDescription">
> <string>We require permission to access your contacts so you can import
> contacts into [redacted]</string>
> </edit-config>
> {code}
> However when I decided to move some stuff from an `after_prepare` hook
> script, to use edit-config, it fails with an error `doc.find is not a
> function`
> {code:xml}
> <edit-config file="*-Info.plist" mode="merge"
> target="NSContactsUsageDescription">
> <string>We require permission to access your contacts so you can import
> contacts into [redacted]</string>
> </edit-config>
> <edit-config file="*-Info.plist" mode="merge" target="UIStatusBarStyle">
> <string>UIStatusBarStyleLightContent</string>
> </edit-config>
> {code}
> If I take out the additional `<edit-config>` everything works.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]