在ipad ios6上保存到主屏幕的web应用程序的cache.manifest / offline使用的奇怪行为 [英] strange behaviour with cache.manifest / offline usage of web app saved to home-screen on ipad ios6

查看:176
本文介绍了在ipad ios6上保存到主屏幕的web应用程序的cache.manifest / offline使用的奇怪行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在iPad上发现了一些使用新iOS 6的奇怪行为。我正在测试一个用于离线使用的网络应用。 Web应用程序只不过是一个带缓存清单的静态网站,因此不会使用像sencha touch这样的特殊框架或像phnoegap这样的工具。只需HTML,CSS和JavaScript以及cache.manifest。

I just discovered some strange behaviour on iPad with the new iOS 6. I'm testing a web app for offline usage. The web app is no more than a static website with a cache manifest, so no special frameworks like sencha touch or tools like phnoegap are used. Just HTML, CSS and JavaScript and a cache.manifest.

该应用程序之前工作正常:我可以将网站保存到主屏幕。当我从那里打开它时,将下载所有数据以进行缓存。在下载结束时,弹出窗口会询问我是否要将缓存增加到50MB - 接受 - 一切都很好 - 离线使用工作正常。

The App worked fine before: I could save the website to the home screen. When I opened it from there, all the data would be downloaded for caching. At the end of the download the pop-up would come to ask if I wanted to increase the cache to 50MB – accepted – everything was fine – offline usage worked.

现在更新到iOS 6后:
我对应用程序进行了一些更改。从主屏幕上卸载应用程序。在移动野生动物园中再次打开它。保存到主屏幕。打开时,下载按原样开始。但随后它冻结了99%。当我在控制台中查找时,收到错误消息:
应用程序缓存更新失败,因为超出了大小配额。

Now after the update to iOS 6: I made some changes to the app. Deinstalled the app from home-screen. Opened it again in mobile safari. Saved to home screen. When opened the download starts as supposed to. But then it freezes at 99%. When I look it up in the console, I get the error-message: "Application Cache update failed, because size quota was exceeded."

这里这是奇怪的事情:当我在浏览器中打开它时,下载开始,最后我被问到是否要将缓存大小增加到50MB。我当然确认了。当我现在在网站数据中查看safari的首选项时,我看到此应用程序的所有缓存数据大约为33MB!所以一点都不超过50MB!

And here comes the weird thing: When I open it in the browser, download starts and at the end I get asked if I want to increase cache size to 50MB. I confirm of course. When I now look in the preferences of safari at "website data", I see that all the cached data for this app is about 33MB!! So not at all more than 50MB!

这是iOS6的错误吗?自从更新到iOS 6以来,在将网站保存到主屏幕时,是否有任何人遇到缓存数据的问题?感谢任何帮助,因为我真的被困在这里...在网上找不到任何有用的东西...

Is this a bug of iOS6? Did anyone experience any problems with caching data, when saving a website to the home-screen since the update to iOS 6? Thx for any help, as I am really stuck here... Couldn't find anything helpfull on the web...

(很遗憾,我无法发布任何链接到网络应用程序和/或它的文件)。

(Unfortunately I cannot post any link to the web app and/or it's files).

编辑:

我发现关于这个问题的更多信息:

I found some more information on this issue:

http://www.nsbasic.com/blog/?p=928

显然保存到主屏幕的wep-apps现在就像原生一样对待应用程序,意味着保存到主屏幕的同一个Web应用程序的每个实例都会获得它自己的存储沙箱。因此,数据与移动Safari中保存的数据不同。这意味着如果您删除所有移动safari的网站数据,这对保存到主屏幕的Web应用程序没有影响(在ios6之前,它们共享相同的数据)。

Apparently wep-apps saved to the home screen are treated now like native apps, meaning each instance of the same web-app saved to the home screen gets it's own "storage sandbox". So the data is independet from the data saved in mobile Safari. This means if you delete all of mobile safari's website-data this has no effect on the web app saved to the home screen (before ios6 they shared the same data).

我也发现了这个:

iOS 6打破了webapps中的GeoLocation(支持apple-mobile-web-app)

虽然不是完全相同的主题,但它可以相关的。显然网页应用已保存到主屏幕

Though not exactly the same topic, it could be related. Apparently web apps saved to the home screen using

<meta content="yes" name="apple-mobile-web-app-capable" />

无法使用地理位置。只有从您的网络应用中删除此元标记时,地理位置才有效。也许这也是缓存问题的解决方法,我无法测试它。但话说回来:如果保存到主屏幕的网络应用程序更像本机应用程序,可能不再需要cache.manifest?如果我发现更多内容,我会在此报告。

wont't be able to use geo-location. Geo-location only works when you remove this meta tag from your web app. Maybe this is also a workaround for the caching problem, I couldn't test it yet. But then again: Maybe the cache.manifest is no longer needed if the web apps saved to home screen are treated more like native apps? I will report back here if I find out more.

EDIT2:

好的经过一些测试,没有来自网络和苹果的有用提示,我发现了至少一些东西:当我删除

Ok after some testing and no useful hints from neither the web nor apple, I found out at least something: When I remove

<meta content="yes" name="apple-mobile-web-app-capable" />

当然一切正常,因为它就像你打开Safari那样我没有问题到目前为止。所以我的兴趣是让它在没有浏览器chrome的情况下工作。如上所述,缓存仅达到99%,然后我得到超出错误的缓存大小配额。然后我关闭了主屏幕应用程序并再次打开它。现在缓存下载再次开始并完成就好了!没有冻结,没有错误!一切似乎都存储在当地。我今天只能在iPad模拟器上进行测试,但我希望我能在以后能够在我们的设备上拿到手来确认这一点。

from the site everything of course works fine, because it's just like you open Safari and there I had no problem so far. So my interest is to make it work without the browser chrome. As described above the caching only goes to 99% and then I get the cache size quota exceeding error. Then I just closed the home screen app and opened it again. Now the caching downloads start again and complete just fine! No freezing, no error! And everything seems to be stored localy. I could only test it on the iPad simulator today but I hope I can confirm this as soon as I can get my hands on our device later.

所以它似乎相反被问到是否要增加缓存大小时,您会获得超出错误的缓存大小配额。也许是因为主屏幕应用程序的数据存储现在处理不同,您不必再手动增加缓存大小(这当然是纯粹的推测)。但是,如果是这种情况,则不应该有任何错误。所以,不要被要求增加缓存大小,你必须打开主屏幕应用程序两次,这是一个相当蹩脚的解决方法btw ......

So it seems like instead of being asked if you want to increase the cache size you get the cache size quota exceeding error. Maybe because data storage for home screen apps now is handled differently you don't have to manualy increase the cache size anymore (which of course is pure speculation). Still, if this was the case, there should not be any error. So instead of being asked to increase cache size you have to open the home screen app twice, which is a pretty lame workaround btw...

EDIT3:

我只能在真实设备上确认此行为:保存到主屏幕 - >从主屏幕打开 - >下载为缓存文件 - >缓存大小配额超出最后的错误 - >关闭主屏幕应用程序(按主页按钮) - >再次重新打开 - >再次缓存文件下载 - >这次没有错误 - > everthing可脱机使用。

I just could confirm this behaviour on a real device: saved to home screen -> opened from home screen -> download to be cached files -> cache size quota exceeding error at the end -> close home screen app (press home button) -> reopen it again -> to be cached files download again -> this time without error -> everthing usable offline.

我还在iOS 5的设备上对它进行了测试,并且它在预期的情况下运行正常,没有错误。所以这绝对是iOS 6的问题。

I also tested it on a device with iOS 5 and there it works like expected without errors. So this is definitely an iOS 6 issue.

其他人可以确认这个行为或错误吗?

Can anyone else confirm this behaviour or bug?

EDIT4:

我偶尔有机会在iOS 6.1.3上测试这个 - 不幸的是仍然是相同的行为......

I occasionally had the chance to test this on iOS 6.1.3 – unfortunately still the same behaviour...

推荐答案

我发现以下链接很有帮助。它解释说,由于Home Screen应用程序现在像本机应用程序一样存储,因此它们有自己的存储/缓存。

I found the following link helpful. It explains that as Home Screen apps are now stored like native apps, they have their own storage/caching.

地理定位在第一次迭代时有效,但从那时起无法更新。

Geolocation works on the first iteration but fails to update from then on.

iOS 6地理位置和本地数据存储


主屏幕应用程序中的数据是现在存储就像原生应用程序一样。原生应用程序每个都有自己的沙箱,用于存储,备份和恢复数据。在iOS 6之前,主屏幕应用程序与浏览器中运行的同一个应用程序共享数据。如果用户清除缓存在浏览器中,应用程序的主屏幕版本也将丢失其数据。在iOS 6中,主屏幕应用程序的数据就像本机应用程序一样保存到沙箱中。备份和恢复正确处理数据,并在浏览器中清除缓存不会影响他们。

"Data in Home Screen apps are now stored like native apps. Native apps each have their own sandbox where their data is stored, backed up and restored to. Prior to iOS 6, Home Screen apps shared data with the same app running in the browser. If the user cleared the cache in the browser, the Home Screen version of the app would lose its data too.With iOS 6, Home Screen apps’ data gets saved to a sandbox just like native apps. Backups and restores handle the data properly, and clear cache in the browser will not affect them."

这篇关于在ipad ios6上保存到主屏幕的web应用程序的cache.manifest / offline使用的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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