If I make an app in PhoneGap that uses localStorage to store key/value data, will this data be synched to other devices via iCloud? I don't need to save much data.
I disagree with @sciritai.
localStorage
in iOS is just an SQLite db file that is stored somewhere on the device.
Perhaps things were different in a previous Phonegap/Cordova version, but in the current version Phonegap writes the localStorage.db
file into the Documents directory for your app.
Specifically: Documents/Backups/localstorage.appdata.db
Since the Documents directory is specific for each app, it will be automatically saved to iCloud.
I can confirm this when I check out the iCloud settings in iOS (under Storage & Backup > Manage Storage
).
I can see that my HTML5 iOS app is being backed up to iCloud. And that includes the data in the localStorage :)
I believe that means if you have multiple devices, that the localStorage would be synced between them - although I have not confirmed that myself. I'm not sure how iOS would deal with conflicts in the localStorage file actually.
I'm with @asgeo1 on this on this one. An phonegap app I just submitted has been rejected by apple because it makes heavy usage of local storage of temporary files and these were being entered into backups on icloud.
The fix is to add this to your config.xml:
<preference name="BackupWebStorage" value="none" />
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