NathanaelA/nativescript-localstorage

Save items to iCloud?

NL33 opened this issue · 7 comments

NL33 commented

My app uses localstorage to save user generated data. Works great; @NathanaelA this plugin is extremely helpful!

I want to now take these items and have them uploaded to iCloud (talking iOS here) to relieve the weight on the user's phone (so items would load from iCloud when user opens the app). I believe that localstorage saves the items to the documents folder, and I believe that the documents folder goes into iCloud, so everything should work if iCloud is set up.

But, after asking everywhere I can think of (including a few times on stackoverflow), I still have not been able to get it to work. And, generally, I do not find any guidance for Nativescript+iCloud mixing.

I have opened my project in xcode, enabled iCloud with CloudKit there, can see that my app id and provisioning profile show iCloud with Cloudkit as being enabled, and then I archive and upload to app store connect. exports.plist even shows icloud as being ready for production.

But app store connect does not show icloud as being enabled, and the app does not have icloud support.

Is there some special configuring of data containers required? Or maybe something unique to this localstorage plugin?

  1. To my knowledge even if the file (as this is a document file) is stored in iCloud a local copy will still be stored on the device; so iCloud won't save any room; but would allow data to be shared between devices.

  2. Yes the file should be stored in the app's doc folder.

NL33 commented

Thanks. Are you aware of any guidance for implementing iCloud with Nativescript?

As I mentioned I have done everything I can find in the docs--and iCloud seems to be enabled in xcode, app id, and provisioning profile--but it is not showing up in the app. I am trying to determine if there is additional configuration that is necessary.

@NL33 - Sorry, I haven't actually played with iCloud.
You might try checking the plugins site https://plugins.nativescript.rocks to see if anything comes up with iCloud.

At worst case feel free to contact us at team@nstudio.io and we can get a quote together to figure it out and create a plugin -- if you really need it.

NL33 commented

Cool. Thanks.

NL33 commented

@NathanaelA in researching iCloud, I saw someone mention that iOS will clear away local storage contents if memory gets low, to make some extra space. (This would be another reason for saving a backup to iCloud.) Is it possible that a user's local storage data could be wiped like that?

No localstorage contents it is talking about is in a browser. The "localstorage" plugin here is actually just a wrapper to the file api that looks like the same localstorage api you would use in a browser to make it simpler for developers to develop with it. Getting low on disk space will not have any impact on this plugin. 😀

NL33 commented

Great. Thanks.