[ 
https://issues.apache.org/jira/browse/CB-13564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16260039#comment-16260039
 ] 

Ryan Murphy commented on CB-13564:
----------------------------------

I encountered the same after following the docs for cordova-plugin-camera. I 
was able to patch it on my machine at `cordova/node_modules/cordova-common` in 
`ConfigChanges.js`. 

*From*
{code:javascript}
var file_xml = self.config_keeper.get(self.project_dir, self.platform, 
editchange.file).data;
var resolveEditTarget = xml_helpers.resolveParent(file_xml, editchange.target);
// etc...
{code}

*To:*
{code:javascript}
var file = self.config_keeper.get(self.project_dir, self.platform, 
editchange.file);
if (file.type === 'xml') {
    var file_xml = file.data;
    var resolveEditTarget = xml_helpers.resolveParent(file_xml, 
editchange.target);
    // etc...
}
// else??
{code}


I'm not sure what the logic is actually doing, so I'm not sure if there should 
be an else for non-xml.

Also I'm making a huge assumption that file.type === 'xml' if it's not plist. 
The only type I encountered in my own usage was plist.

> 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
>
> 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
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to