4
votes

We developed an offline HTML5 web-app using the .manifest caching mechanism. Everything works as expectet.

Now some of our customers complain that after a long period of offline usage the cached data suddenly disappeared. It turns out - this is my guess - that iOS stores the cached files in its /CACHES/ directory, which, since iOS 5.0, can get purged if the device gets out of space. This can happen anytime, without even a warning to the user. Hence, the offline webapp is no longer running properly. The user has to reconnect the device to the internet and update the app.

For native Apps this problem is solved by storing the files in the /DOCUMENTS/ dir, using the flag 'do not backup' which prevents the files from being purged (since they don't sit in the /CACHES/ dir, and are not backed up to iCloud or iTunes.

See this link for details: http://www.marco.org/2011/10/13/ios5-caches-cleaning, however this does not say anything about HTML5 caching...

This one explains it again, however no solution: http://www.moneytoolkit.com/2012/04/apple-ios-html5-localstorage-is-broken/

Has anyone experienced the same? Is there a solution to this? The goal is to install a web-app once, and then run it without connection 'forever'...

Cheers, pawi

1

1 Answers

0
votes

There is no way around this in Safari. A cache is never considered to be permanent.

If you have a UIWebView inside a native app, you can set WebKitStoreWebDataForBackup to YES in your user defaults. (iOS 6+ only)