在PhoneGap 3.4中暂存文件夹的目的?只有对此文件夹中的index.html的更改才能被识别? [英] Purpose of Staging folder in PhoneGap 3.4? Only changes to index.html in this folder get recognized?

查看:266
本文介绍了在PhoneGap 3.4中暂存文件夹的目的?只有对此文件夹中的index.html的更改才能被识别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们注意到在使用PhoneGap 3.4创建项目后,出现在Xcode的项目导航器中的暂存文件夹。使用PhoneGap 3.2或更低版本创建项目时,未出现此暂存文件夹。 PhoneGap文档很糟糕,我们找不到为什么这个文件夹存在的解释。



更重要的是,它看起来像正常的索引.html 文件无法识别,并且只会更改 index.html 暂存文件夹。为什么是这样?

解决方案

我刚刚在困惑。



简短结论:



staging文件夹包含那些www分发到iOS应用程序包。临时文件夹完全被来自文件夹my_cordova_project / www / (所有平台的常见www代码)和my_cordova_project / merges / ios / (用于Xcode的特定www代码)项目)。这两个文件的内容将被编辑。 my_cordova_project / www / 的内容在所有平台上保持不变,由 cordova build 命令组织。从Cordova 3.3,似乎Xcode build for ...命令不足以用于整个过程,您还需要调用 cordova build 命令,以便同步所有





长回答文件夹:

   my_cordova_project / platforms / ios / www /

在Xcode中映射为

   / my_xcode_project / staging / www /



您可以通过Finder暂时更改文件名,



文件夹:

   my_cordova_project / www / $ b在Xcode中映射为

   / my_xcode_project / www /



然后考虑Cordova的合并概念,允许为特定平台分发特定的www文档(参见此处)。这可以通过将它们放入文件夹 my_cordova_project / merges / 中并使用命令行 cordova build 命令来实现。看来 cordova build 不仅意味着第一次创建应用程序。如果您开始构建并观察Xcode中的树,您会看到 / my_xcode_project / staging / 文件夹被 my_cordova_project / www / 完全覆盖合并文件夹)。



这特别符合 here


警告:构建你的应用程序,你不应该编辑/ platforms /目录中的任何文件,除非你知道你在做什么,或者文档指定其他。


当我在早期版本的工作时,这个目录中的文件会被定期覆盖以备建立应用程序或重新安装插件。 PhoneGap中,www内容在每个平台项目中存储和编辑,因此您必须将www从一个平台复制到另一个平台。今天,只有一个www文件夹由 cordova build 在所有平台上自动分发。它非常方便,可以通过merges文件夹调整特定的平台。



因此, cordova构建的影响也可以在Eclipse ADT中观察到,甚至交叉。只需在 / my_xcode_project / www / 中运行Xcode,运行 cordova build ,刷新Eclipse ADT中的树,



另一方面,Xcode为运行命令的构建不是复制所有 / my_xcode_project / www / 键入 / my_xcode_project / staging / www / 。这只能通过 cordova build 命令完成。但是,如果你检查一个生产的应用程序,你会发现从 / my_xcode_project / staging / www / 的文件,所以如果你编辑 / my_xcode_project / www / ,你必须调用 cordova build


We noticed a Staging folder that appears in Xcode's Project Navigator after creating a project with PhoneGap 3.4. This Staging folder didn't appear when creating projects with PhoneGap 3.2 or lower. The PhoneGap docs are terrible, and we can't locate the explanation for why this folder exists.

More importantly, it seems like the normal index.html file isn't recognized anymore, and only changes to index.html inside the Staging folder get recognized. Why is this?

解决方案

I just stumbled over it too and found no explanation. I have just been puzzling around.

Short conclusion:

The "staging" folder contains those www assets that are distributed into an iOS app bundle. The staging folder is completely overwritten with files from the folders my_cordova_project/www/ (common www code for all platforms) and my_cordova_project/merges/ios/ (specific www code for Xcode project). The contents in these two are to be edited. The contents of my_cordova_project/www/ remain the same over all platforms, which is organized by the cordova build command. As of Cordova 3.3, it seems the Xcode build for ... command is not sufficient for the whole process, you also need to invoke the cordova build command in order to synchronze all folders properly.


Long answer:

The folder:
  my_cordova_project/platforms/ios/www/
is "mapped" in Xcode to
  /my_xcode_project/staging/www/

You can check this by altering a file name temporarily with Finder and observe the tree in Xcode.

The folder:
  my_cordova_project/www/
is "mapped" in Xcode to
  /my_xcode_project/www/

Then consider Cordova's merges concept that allows to distribute specific www documents for specific platforms (see here). This happens by putting them into the folder my_cordova_project/merges/ and using the command line cordova build command. It seems that cordova build is not only meant to create the app the first time. If you start a build and observe the trees in Xcode, you will see that the /my_xcode_project/staging/ folder is completely overwritten by my_cordova_project/www/ (and specialized by the merges folder).

This especially matches with this cite from here:

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.

When I worked with early versions of PhoneGap, the www content was stored and edited in each platform project, so you had to copy the www from one platform to another. Today, there is just one www folder that is automatically distributed over all platforms by cordova build. It's very handy, and it can be adjusted for specific platforms by the merges folder.

So, the impact of a cordova build may be observed in Eclipse ADT as well, and even crossover. Just change something in Xcode in /my_xcode_project/www/, run cordova build, refresh the tree in Eclipse ADT and you will find your change distributed.

On the other hand, it is a bit puzzling that Xcode's build for running command does not copy all /my_xcode_project/www/ into /my_xcode_project/staging/www/. This is done only by the cordova build command. Yet if you inspect a produced app, you will find the files from /my_xcode_project/staging/www/, so if you edit /my_xcode_project/www/, you have to invoke cordova build too.

这篇关于在PhoneGap 3.4中暂存文件夹的目的?只有对此文件夹中的index.html的更改才能被识别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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