Archive for April, 2012

Fixing localStorage and WebSQL Databases on iOS5.1

If you’re an iOS developer using an embedded webkit UIWebView in your app, then you’ve probably stuck the problem where your localStorage and WebSQL databases will just disappear when upgrading your app on iOS5.1. Other symptoms for this bug are not being able to call window.openDatabase() (it throws a “SECURITY_ERR: DOM Exception 18” error) or not being able to save to localStorage, after upgrading your app on iOS5.1. This was particularly painful for me when using a framework such as PhoneGap. The reason for this happening is that as of iOS5.1 the database files are stored in the Caches folder, which can potentially be wiped when an app is reinstalled or upgraded, or even if the device runs out of memory. Apparently it’s some kind of new thing to stop databases being automatically installed to iCloud. The other problem is that when upgrading/reinstalling your app, it gets given a new path on the storage, but the WebView preferences aren’t updated automatically to point to the new location.
Read the rest of this entry »

, , , , , ,

1 Comment