CloudKit With CoreData Initial Sync On New Device - ios

I have an app that uses CloudKit to sync a private database data between multiple devices. I am using CoreData for local persistence of the data. When the user downloads my app on a new device, I am currently downloading all the records from CloudKit and performing a lot of processing to properly build the CoreData persistence on the new device. As the amount of records grows, the processing time will continue to grow.
I was thinking it would be more efficient to transfer a copy of CoreData from iCloud file storage to build the initial local persistence file on the new device. Is there a way to use CloudKit in conjunction with iCloud file storage to build the initial persistence file and then use CloudKit to maintain synchronization between devices after the initial sync?
All the tutorials I have seen use either CloudKit or iCloud file storage rather than a hybrid approach.

Related

Recommendation on how to store mp3 and image files in Core Data which is synced with CloudKit

I have an app that needs to work offline but sync across devices. The plan is to use Core Data and CloudKit to achieve this.
My question is how to store mp3 and image files (small file sizes). Is it ok to store it as Data and enable "Allows external storage" ? Will That works for CloudKit synchronisation

iOS11 Safari: Add to Home-screen localstorage lifecycle

I found Home-Screen app localstorage is not deleted by Safari clear cache.
It seems to be persistent storage, but I cannot find any documents about this.
My Question is
Is there any document about this behavior?
Home-Screen app localstorage lifecycle. when will be cleared? how to clear?
Can I use localstorage to save persistent token for PWA?
There is localstorage tester here
Local storage is not cache, it is persistent storage. You can add or delete values manually.
Apple's documentation says the following:
Safari supports the latest HTML5 offline data storage features. Your
application can store its information on the local machine using
either a simple key/value-based data store, or a robust SQL database.
The data is stored locally and persists across launches of Safari so
your application doesn’t need a network connection to access the data,
improving startup time and overall performance.
This storage is limited to 5 MB and can be cleared if the device is running low on space, but this is the main way to store data on the user's device.
You can learn more about local storage here

CloudKit offline storage

I'm developing iOS app which is using CloudKit. I'm pretty clear how to download/upload data from cloud when requested on the device. It works just fine when internet connection is present. I'm thinking to allow users to access their data offline also. After brief research I discovered that CoreData integration with iCloud was depreciated as of recent Xcode release. I found some third party pods on github which let you handle this problem by syncing core data from device to iCloud. I'm a bit skeptical using those plugins due to possible data loss or other issues. Is the idea behind depreciating CloudKit to move away from offline storage? Im thinking now what to do... should I attempt to create some sort of sync between core data and iCloud or not use core data at all and just let users to access data only when online connection available. Such approach would save device storage but restrict data access to online only. Any recommendations ?
CoreData integration with iCloud is not depreciated, here are some references from Apple:
Setting up core data with CloudKit
Syncing a core data store with CloudKit
Mirroring a core data store with CloudKit
WWDC 2019 - Using Core Data With CloudKit

CloudKit and Core sync data between devices

I created a simple Notes app based on Core data. Now i want add sync between user devices.
And all articles that i read (this, this) said that i should fully get rid of my core data database, and all my code will lost and rework all with ICloud kit?
The is no way to sync data from Core Data to ICloud ? And if i get rid of core data, how my app will work offline ?
And please suggest good simple projects with ICloud sync
P.S. I googled about an hour. Icloud is deprecated so do sync with it is not recommended. I confused. How now i can sync data between devices??
Core Data used to have iCloud syncing, but it has been deprecated as of iOS 10. It had several problems, sometimes major.
Apple now has something called CloudKit, which is not the same thing. You can use CloudKit to sync data between devices. But this does not mean that you should drop Core Data. CloudKit only syncs; it is not a replacement for having your app save data on the device, it's only a way to send data to other devices. If you're using CloudKit, you also need to use some other way to store data on the local device.
Also, it's "CloudKit". Not "ICloud Kit". I don't know why, but it's important to get the names right.

Using iCloud for core data sync

Mine is a background application. There are thousands of data that are stored in local storage and till now i've been syncing the data to a remote server using http post. I want to know whether it is possible for me to use iCloud to sync my core data and then is it possible to sync from iClod to a remote server. I just want to use iCloud for storage purpose. I meant can it be operated like Parse and other third party cloud servers. I'm stuck with this. Any help would be greatly appreciated.
The only thing iCloud with Core Data does for you is sync data between multiple devices that use the same iCloud account.
I want to know whether it is possible for me to use iCloud to sync my core data...
Sync from one device to another, yes.
...and then is it possible to sync from iClod to a remote server.
If you're using Core Data with iCloud, you're still using Core Data, so any server sync you're doing now with Core Data will continue to work in the same way.
I just want to use iCloud for storage purpose.
It does store the user's data on the iCloud service, though it can only be accessed through your app.
I meant can it be operated like Parse and other third party cloud servers.
It depends on what Parse (or other third party) services you're interested in. Parse does more than iCloud, it's not really the same thing. If you would use Parse only to sync data between different devices, you could probably use iCloud. If you would use Parse in any other way at all, iCloud is not a replacement.

Resources