1

我正在使用 PhoneGap 3.0 CLI 通过以下命令创建示例应用程序:

phonegap create MyTestApp com.example.mytestapp MyTestApp

然后我看到了两个不同的 config.xml 文件,下面是我在项目根 www 文件夹中看到的:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.mytestapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

其中 id 属性正确且版本为 1.0.0

但是我在 /platforms/ios/MyTestApp/config.xml 中看到的有点不同:

<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">

id 错误,版本为 2.0.0

为什么它们不同?您知道,每次我们运行 phonegap build ios 命令时,都会重新创建 iOS config.xml 文件。

4

1 回答 1

1

It might seem confusing to see the different config.xml files if you’re perusing through what’s created by the CLI commands. There is a sample config.xml in your root www folder that is used when a project is built remotely by PhoneGap Build (via the phonegap build remote command).

However, when you are building locally for a platform you will make platform-specific changes to a config.xml file for each platform in a separate location. For instance, for android you will find it under a path like yourprojectroot/platforms/android/res/xml/config.xml.

For ios you will find it under yourprojectroot/platforms/ios/yourprojectname/config.xml. This might lead to confusion if you’re not paying attention since you will also see the sample one in the platforms www folder which was copied down from the root project. The one in the platform-specific directory is the one to update and modify.

PhoneGap 3.0 – Stuff You Should Know

于 2013-11-22T22:37:08.997 回答