通过 Cordova config.xml 向 iOS .plist 文件添加条目 [英] Add entry to iOS .plist file via Cordova config.xml

查看:30
本文介绍了通过 Cordova config.xml 向 iOS .plist 文件添加条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Cordova CLI 的新手.

I am new to the Cordova CLI.

我需要通过 Cordova 以编程方式执行以下步骤.

I need to perform the following steps programmatically via Cordova.

  1. 在 .plist 项目中添加一个新行
  2. 在新行中输入以下值:
  3. :GDLibraryMode 类型:字符串(默认):GDEnterpriseSimulation
  1. In the project .plist add a new row
  2. Enter the following values in the new row:
  3. Key: GDLibraryMode Type:String (default) Value:GDEnterpriseSimulation

我想我需要在项目根目录的 config.xml 文件中执行此操作(或者可能是platforms"文件夹中的那个).

I think I need to do this in the config.xml file in my project's root (or maybe the one in the "platforms" folder).

有人可以向我解释如何通过 config.xml 添加条目,以便在编译时添加上述条目吗?

Can someone explain to me how to add the entry via the config.xml so that the above entry is added at compile-time?

我使用的是 Cordova 3.3.1-0.42(我知道它不是最新的).我已经完成了我的项目,一切都很好,我只需要将此条目添加到 pList 中即可.

I am using Cordova 3.3.1-0.42 (I know it is not the latest). I have already made my project and all is fine, I just need to add this entry added to the pList.

2/8/21根据对此问题的评论:

2/8/21 As per a comment on this question:

对于迟到的任何人,Cordova CLI 7 及更高版本

推荐答案

我不认为你可以通过直接的 config.xml 修改来做到这一点.至少,我在文档中没有看到任何提及:http://cordova.apache.org/docs/en/3.3.0/config_ref_index.md.html

I don't think you can do this via straight config.xml modification. At least, I didn't see any mention of this in the docs: http://cordova.apache.org/docs/en/3.3.0/config_ref_index.md.html

我认为您必须创建一个插件,因为它们可以插入 plist 条目:http://docs.phonegap.com/en/3.3.0/plugin_ref_spec.md.html#Plugin%20Specification

I think you have to create a plugin, because they can insert plist entries: http://docs.phonegap.com/en/3.3.0/plugin_ref_spec.md.html#Plugin%20Specification

请参阅配置文件元素"部分.以下是对 plugin.xml 的相关部分的外观的猜测:

See the 'config-file element' section. Here's a guess as to what the relevant section of the plugin.xml will look like:

<platform name="ios">
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
    <dict>
        <key>GDLibraryMode</key>
        <string>GDEnterpriseSimulation</string>
    </dict>
</array>
</config-file>
</platform>

然后就可以安装插件了:cordova plugin add <你的插件名称或文件位置>

Then you can install the plugin: cordova plugin add <your plugin name or file location>

这篇关于通过 Cordova config.xml 向 iOS .plist 文件添加条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆