I have a iOS app built using Ionic (Cordova and Angular). Version 1 of my app (which has been released for a while) stores some data using HTML5 localStorage. I'm ready to release version 2 but updating the app (I've simulated both via xcode, itunes and via a testflight install) wipes all the data stored in localstorage.
It seems the localstorage db is stored in Library/Caches/ if that is helpful.
For info I'm using:
Cordova 3.9.2 and Ionic 1.1.1
After spending all day searching SO and various other sites I'm still no wiser.
Is there a way to prevent this? Interested to hear from anyone using localStorage on a released cordova app.
As you mentioned the localstorage is stored in Library/Caches. This directory may get cleared by the OS if the system is very low on space (File System Programming Guide).
If the system isn't low on space the data should be available after app updates. We are using localstorage in our app too and having problems with loosing data when the device runs out of space.
After researching I've found a plugin especially for this problem. This plugin is using NSUserDefaults (iOS) and SharedPreferences (Android) to store the data permanently. This is actually my preferred solution for this problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With