Phonegap - 无需将应用程序提交到 appStore 即可更新 JavaScript 和 CSS [英] Phonegap - Updating JavaScript and CSS without submitting the app to appStore

查看:25
本文介绍了Phonegap - 无需将应用程序提交到 appStore 即可更新 JavaScript 和 CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在每次更改appStore时不提交应用程序而更新phonegap中WWW文件夹的内容?是否存在法律问题?

Is it possible to update the content of WWW folder in phonegap without submitting the app every time you make changes to appStore? Is there any legal issue with it?

推荐答案

简短回答 - 是的,您可以 - 但您需要先重新定位 www,然后才能写入.

Short answer - yes, you can - but you need to relocate www before you can write to it.

长答案 - 收紧你的短裤朝圣者,这可能会变得颠簸......

Long answer - tighten up your shorts pilgrim, this might get bumpy....

因此,当您打包您的应用程序时,应用程序包包含您的 www 目录以及您的 PG 独立网络应用程序的所有各种杂项部分.应用程序包中的所有内容都是静态的 - 因此无法写入.但是,您可以为您的应用程序写入 NSDocumentDirectory - 它是私有的沙盒存储区域.

So, when you package your app, the app bundle contains your www directory and all of the various and sundry parts of your PG self contained web app. Everything that is part of the app bundle is static - so it cannot be written to. You can, however, write to the NSDocumentDirectory for your application - it's private sandboxed storage area.

第一步是(在启动时)将您的 www 文件夹复制到 NSDocumentDirectory 中.

The first step is to (upon launch) copy your www folder into the NSDocumentDirectory.

其次,您需要重写 CDVCommandDelegateImpl pathForResource 方法,以便将 PG 指向新的 www 位置.

Second, you'll need to override the CDVCommandDelegateImpl pathForResource method in order to point PG at the new www location.

此时,您的应用应该像包含在应用程序包中时一样运行.一个值得注意的例外是现在可以修改每个文件.

At this point your app should be operating as it did when contained within the app bundle. One notable exception is that each of the files can now be modified.

我的应用是一个基础产品,可以有附加内容.如果我包含所有附加内容,该应用程序的大小将达到数百 MB.因此,我将基本应用程序包含在一个(示例)数据包中,当用户需要扩展产品时,他们会选择其他数据包,这些数据包被下载、提取并复制到 www 文件夹的相应子目录中,因为它存在于NSDocumentDirectory.

My app is a base product which can have add-on content. If I included all of the add-on content, the app would be several hundred MB in size. So, I include the basic app with a single (sample) data package, and as users need to extend the product, they select additional data packages which are downloaded, extracted and copied into the appropriate subdirectory of the www folder as it exists in the NSDocumentDirectory.

作为奖励,如果我发现 HTML 中的错误 - 或者想要添加功能,我可以这样做而无需重新提交应用程序.我需要重新提交应用的唯一原因是是否存在 Objective-C 错误修复.

As a bonus, if I find a bug in HTML - or want to add a feature, I can do so without resubmitting the app. The only reason I need to resubmit the app is if there is an Objective-C bugfix.

这篇关于Phonegap - 无需将应用程序提交到 appStore 即可更新 JavaScript 和 CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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