简体   繁体   English

iOS4清除缓存错误?! 带有“添加到主屏幕”应用程序和localStorage

[英]IOS4 Clear cache bug?! with “Add to Home Screen” apps and localStorage

we've got an App going live very shortly but I've discovered what looks like an IOS4 bug with Settings --> Safari --> Clear Cache. 我们有一个即将上线的应用程序,但是我通过设置-> Safari->清除缓存发现了一个看起来像IOS4的错误。

Our app is authorized then used by, going to the website in Safari, authorizing, this creates a localStorage key then the user can launch in app-mode (from home screen) and the localStorage key is picked up. 我们的应用程序经过授权后,通过使用Safari浏览器中的网站进行授权,这将创建一个localStorage密钥,然后用户可以以应用程序模式启动(从主屏幕),并拾取localStorage密钥。

This works fine in IOS5 and works fine in IOS4. 这在IOS5中正常工作,在IOS4中正常工作。 UNTIL!!! 直到!!! You delete your cache, then the iPhone disallows your website (based on it's URL I'm assuming) to create any future localStorage Keys. 您删除缓存,然后iPhone不允许您的网站(基于我假设的URL)创建任何将来的localStorage密钥。

Each Home screen icon, has its own localStorage SET of key/values, 每个主屏幕图标都有其自己的本地存储键/值集,

IE IE浏览器

If I add a localStorage value from myurl1.com, add to home screen, clear cache, load, it fails 如果我从myurl1.com添加localStorage值,则添加到主屏幕,清除缓存,加载,它将失败

then if I do it from myurl2.com, (with same key), I can successfully load the newest home screen icon but still not the last. 那么如果我从myurl2.com(使用相同的键)进行操作,则可以成功加载最新的主屏幕图标,但不能成功加载最后一个。

Anyway, my issue is, Once a user clears their cache there appears to be no way for them to EVER launch the app from the home screen again as its permanently disallowed our website from creating more localStorage keys.. 无论如何,我的问题是,一旦用户清除了缓存,他们似乎永远无法从主屏幕再次启动该应用程序,因为它永久禁止我们的网站创建更多localStorage密钥。

What do I Do?!?! 我该怎么办?!?!

Have you tried debugging that eg. 您是否尝试过调试,例如。 with Weinre (good online version: http://debug.phonegap.com ). 使用Weinre(良好的在线版本: http//debug.phonegap.com )。 I mean whether there are any errors thrown, it'd be good to see them here. 我的意思是说是否有任何错误抛出,很高兴在这里看到它们。

We had same kind of problem, but it was related to browsing in private mode, so it's probably not the situation in your case. 我们遇到了同样的问题,但与私有模式下的浏览有关,因此您所遇到的情况可能并非如此。

Otherwise, I've never seen this happening. 否则,我从未见过这种情况。 localStorage has always worked just fine, no matter whether the cache is flushed or not. 无论是否刷新缓存,localStorage始终可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM