Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap iOS 7 and localStorage

I’m currently building a PhoneGap 3.3.0 iOS application which uses Ember.js/EmberData with a LocalStorage adapter to persist data. After reading some articles like this StackOverflow question I’d like to know how the LocalStorage data is handled by iOS 7. Is it stored permanently or still stored in a cache folder which is note backed up to iTunes/iCloud? Unfortunately, the PhoneGap documentation on LocalStorage only refers to the official W3C spec.

The only thing said about the handling of the web storage is a description of a flag in the config.xml:

BackupWebStorage (string, either none, local, or the default cloud): Set to cloud to allow web storage data to backup via iCloud. Set to local to allow only local backups via iTunes sync. Set to none prevent web storage backups.

<preference name="BackupWebStorage" value="local"/>

The Safari Docs also don’t mention the internals of the LocalStorage implementation and how it is treated in a App update cycle.

I’d really like to know how the LocalStorage data is handled by iOS 7, and maybe if there is a doc on this that I’ve missed, then can someone please point it out to me.

like image 507
wowpatrick Avatar asked Feb 11 '14 15:02

wowpatrick


1 Answers

If your question is "does local storage persist after app update cycle" I can say yes based on experience with my app.

I have set

<preference name="BackupWebStorage" value="local" />

in the config.xml. I store a journal of I-Ching readings to local storage and have now been through two app update cycles with no user data loss. I don't have any further documentation on the mechanics though.

like image 167
brianfit Avatar answered Oct 06 '22 02:10

brianfit