Cordova/PhoneGap-是否在/platforms/中编辑文件? [英] Cordova/PhoneGap -- edit files in /platforms/ or not?

查看:45
本文介绍了Cordova/PhoneGap-是否在/platforms/中编辑文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位长期的本地iOS开发人员,正在尝试在Cordova/PhoneGap上学习.我正在阅读文档在我看来,有两个矛盾的说法:

I'm a longtime native iOS developer who's trying to school myself on Cordova/PhoneGap. I'm reading through the documentation and it seems to me there are two contradictory statements:

警告:使用CLI构建应用程序时,除非您知道自己在做什么,或者文档另有规定,否则不应编辑/platforms/目录中的任何文件.准备构建应用程序或重新安装插件时,通常会覆盖此目录中的文件.

WARNING: When using the CLI to build your application, you should not edit any files in the /platforms/ directory unless you know what you are doing, or if documentation specifies otherwise. The files in this directory are routinely overwritten when preparing applications for building, or when plugins are reinstalled.

再往下走:

cordova build命令是以下命令的简写,在本示例中也是 定位到单个平台:

The cordova build command is a shorthand for the following, which in this example is also targeted to a single platform:

cordova prepare ios

cordova compile ios

In this case, once you run prepare, you can use Apple's Xcode SDK as an alternative to
modify and compile the platform-specific code that Cordova generates within
platforms/ios. You can use the same approach with other platforms' SDKs.

那...是什么?我是否不应该编辑特定于platfom的文件,而只能在/www/目录中工作?还是我要处理特定于平台的文件?

So...which is it? Am I not supposed to edit the platfom-specific files and instead work only in the /www/ directory? Or do I work on the platform-specific files?

谢谢.

推荐答案

如果您使用的是第一种方法,即每次使用cordova prepare 构建APP,则与平台目录将被覆盖.

If you are using the first approach i.e building the APP using cordova prepare everytime you build your project than the files in the platform directory will be overwritten.

second 方法中,您只运行cordova prepare 一次,然后使用您的 native SDK开发方法来更改平台目录进行编译和构建.
在第二种方法中,您从不再次使用cordova prepare命令,因为它会覆盖您在 platform 目录中的文件.

Whereas in the second approach you run the cordova prepare only ONCE and then use your native SDK development method to change the files in the platform directory for compiling and building.
In the second approach you NEVER again use the cordova prepare command as it will overwrite your files in the platform directory.

这篇关于Cordova/PhoneGap-是否在/platforms/中编辑文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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