如何使用不同的config.xml不同的Phonegap目标在Xcode? [英] How to use different config.xml for different Phonegap Targets in Xcode?

查看:190
本文介绍了如何使用不同的config.xml不同的Phonegap目标在Xcode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要在我的Phonegap Xcode项目中有多个目标,它们共享资源,但从不同的index.html文件加载。

I want to have multiple targets in my Phonegap Xcode project that share resources but load from a different index.html file.

加载的索引文件已确定通过config.xml文件。

The index file that is loaded is determined by the config.xml file.

如何为这些不同的目标定义不同的config.xml文件或不同的index.html文件。

How can I define a different config.xml file or a different index.html file for these different targets.

或者,是否有更好的方式来应用设置,并部署一个99.9%相同的应用程序?

Alternatively, is there a better way to apply settings, and deploy an app that is 99.9% the same?

Cordova 2.8.1。

I'm using Cordova 2.8.1.

谢谢。

推荐答案

PhoneGap的CDVViewController .m从主包中读取config.xml,以便您可以

PhoneGap's CDVViewController.m reads config.xml from the from the main bundle, so you can


  1. 为每个目标创建单独的目录。

  2. 在步骤1的相关目录中为每个目标创建一个config.xml。

  3. 使用Xcode的Utilities视图中的Target Membership面板设置每个config.xml从第2步到正确的目标。

如果唯一的区别是开始HTML文件,可以修改AppDelegate。 m并使用编译时常量定义起始页:

If the only difference is the starting HTML file, you could modify your AppDelegate.m and use a compile-time constant to define the starting page:

self.viewController.startPage = [NSString stringWithFormat:@"%s", START_HTML_FILE];

要设置编译时间常数,请转到Xcode中的Build Phases选项卡 / em>并使用-D编译器标志。例如,

To set the compile time constant, go into Build Phases tab in Xcode for each target and use the -D compiler flag. For example,

-DSTART_HTML_FILE=\"target1-index.html\"

这篇关于如何使用不同的config.xml不同的Phonegap目标在Xcode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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