如何使用不同的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的相关目录中为每个目标创建一个config.xml。
- 使用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\"