NSPersistentCloudkitContainer makes Cloudkit Metadata Migrator


Hello.

Now I'm trying to add Cloudkit + iCloud synchronization feature with NSPersistentCloudkitContainer.

It's super easy and cool.


However, When I tried some test with large data, there is expensive cost task on every app launch time.

Actually, this task also executed on small dataset, but its cost increased by increasing local core data storage.

This task seems like migration for cloudkit.

I guess that this task save additional data on local storage.
(I checked this on Settings > General > iPad Storage)

This task takes 20 minutes (with 5GB test data, core data storage) on background thread , using full of one core cpu.

Importantly, if there is new data to sync, the synchronization starts after this heavy migration task ends.

So if user create new data and terminate application before migration ends, that new data never synchronized.


Also, if I delete my cloud data on Settings > Account > iCloud > Manage Storgae, my local app storage remain some of data.

My all local data to used on application is deleted, but some data remains.

I guess this data is related to migration task.

The evidence is that application still execute migration task after deleting all cloud data, and local storage increases while this task executing.


I submit the core data stack I used and capture of time profiling.

Please give some advice.

Thank you.



ps. Additionally I update all rows to force sync for existing data(before NSPersistentHistoryTrackingKey added), is it right method?







NSPersistentCloudkitContainer makes Cloudkit Metadata Migrator
 
 
Q