Search code examples
iosangularcordovaionic-frameworkicloud

Cordova plugin not saving to iCloud


I am using Ionic with the following plugin: cordova-plugin-icloudkv to persist data in Apples iCloud.

I call:

sync(successCallback/*(dictionary_with_all_sync_keys)

then:

save(key, value, successCallback)

Which saves, i.e. I can access it again with:

load(key, successCallback/*(value)*/, failCallback)

and get the saved value as expected.

Problem

When I close the app, and restart it, and try:

sync(successCallback/*(dictionary_with_all_sync_keys)

then:

load(key, successCallback/*(value)*/, failCallback)

I get:

key is missing

It is as if, the value is not being persisted to iCloud, but rather only local storage, which is lost when the app is closed.

Question

How can I make the above persist to iCloud?

Thanks


Solution

  • I guess you may have to read the plugin usage once again in the official link

    It states as follows,

    Reminder: Calling sync does not guarantee (or matter for) syncrhonization with iCloud but only between the in-memory and the flash storage that will be eventually synced with iCloud by an independent agent.

    So the syncing actually depends on the independent agent. This plugin just pushes the data that can be made available for syncing. Hope it helps