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

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

问题描述

首先让我先说我对科尔多瓦CLI有点新。无论如何,这里是我的问题:



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


  1. 在项目中.plist添加新行

  2. 在新行中输入以下值:
  3. b $ b

我想我需要在项目的根目录(或者platforms文件夹中的config.xml文件)中这样做。 p>

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



我使用Cordova 3.3.1-0.42(我知道它不是最新的)。我已经做了我的项目,一切都很好,我只需要添加这个条目添加到pList。



非常感谢!



〜Red

解决方案

我不认为你可以通过直接 config.xml 修改。至少,我在文档中没有提到这一点: 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



请参阅config-file元素部分。下面是对 plugin.xml 的相关部分如下所示的猜测:

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

然后您可以安装插件: cordova plugin add&或文件位置>


First let me preface that I am somewhat new to the Cordova CLI. Anyway, here is my question:

I need to perform the following steps programmatically via Cordova.

  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

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).

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

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.

Thanks so much!

~Red

解决方案

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

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

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>

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

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

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