Web 应用程序缓存 iOS
我正在开发一个 Web 应用程序,它可以通过缓存清单文件中的所有内容来允许离线使用。我遇到了一些问题,希望你能帮助我。
问题是当我将网络应用程序添加到主屏幕时,它有很多错误。问题是:
- 有时它不会显示任何内容,它告诉我打开 wifi(我在飞行模式下测试)。这似乎是随机发生的。通常,如果我关闭应用程序,连接到互联网,重新启动应用程序,然后进入飞行模式,它就会起作用。
- 有时,整个代码都没有加载,一切都搞砸了。在这种情况下,重新启动应用程序始终有效。
- 有时会缺少内容。首先,我认为在进入飞行模式之前根本没有完成缓存所有内容。但我已经经历过这样的情况:一开始它可以工作,但关闭并重新启动应用程序将使内容不可用。
调试起来确实很痛苦,因为它只在将 Web 应用程序添加到主屏幕时发生,并且您无法在 Web 应用程序模式下真正进行调试(据我所知,欢迎提示!)。我已经在 Firefox、Chrome 和 Safari Mobile 上测试了离线模式(没有将其添加到主屏幕),没有任何问题。
顺便说一句,我正在运行 iOS 5 的 iPad 1 上测试所有这些,并且 Web 应用程序使用 jquery mobile。 iOS 4 也经过了测试,也给了我同样的问题,尽管它在 iOS 5 上似乎好一点。当连接到互联网时,网络应用程序总是按预期工作,所以问题出在缓存上。
有人有什么想法吗?或者也许有关于如何在 webapp 模式下调试的提示?
I am working on a web application that allows offline usage by caching everything in the manifest file. I am running into a few problems I hope you can help me with.
The problem is that the webapp is very buggy when I add it to homescreen. The problems are:
- Sometimes it wont show anything and it tells me to turn on wifi (I test in airplane mode). This seems to be happening randomly. Usually it works if I close the app, connect to the internet, restart the app, and then go to airplane mode.
- Sometimes not the entire code is loaded and its all messed up. Rebooting the app always works in this case.
- Sometimes there is missing content. First I thought it was simply not done caching everything before I went to airplane mode. But I already experienced a situation where it worked at first, but closing and restarting the app would make the content unavailable.
Its a real pain to debug since it only occurs when adding the webapp to homescreen and you can't really debug in webapp mode (as far as I know, tips welcome!). I have tested offline mode in firefox, chrome and on safari mobile (without adding it to homescreen) and there are no problems there.
By the way, I am testing all this on an iPad 1 with iOS 5 and the webapp is using jquery mobile. iOS 4 has been tested aswell and gave me the same problems, tho it seems to be a little bit better on iOS 5. The webapp always works as it should when connected to the internet so the problem is with the caching.
Any ideas anyone? Or maybe tips on how to debug in webapp mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要调试 Web 应用程序,请尝试这个! iWebInspector 您可以将 Web App 加载到此调试器中。而且它是免费的。
For debugging Web App try this one! iWebInspector You can load Web App into this debugger. And it's free.
解决了问题。缓存文件的格式不正确。我不知道我怎么会错过它。现在一切都很顺利。
Solved the problem. The cache file wasn't formatted properly. I don't know how I could have missed it. Everything is working perfectly now.