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.
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.
来源:https://stackoverflow.com/questions/21706286/phonegap-ios-7-and-localstorage