CloudKit locally cached

throughout the 231 session (WWDC 2016)

is the reference to locally cached

ChangeToken

subscription , etc..

which is easy to understand storing this within UserDefaults


BUT !

what about storing the data locally (more like database)

Why/How do we store a Core Data amount of data "cached locally" ?


I've seen a few sites/tutorials but alot of that has been deprecated with iOS 10


So how do we keep a local copy of the database for the many cases where the network is unavailable

But the app can still be used with local data and then all changes synced when CloudKit / network becomes available


Where is there code (sample code even) that helps Store CloudKit locally within Core Data ?


All help appreciated

Replies

https://github.com/yapstudios/YapDatabase

Try YapDatabase (link currently moderated)

I bet this is the most popular question about CloudKit.


CloudKit is a transport technology. It does not provide any data persistance at all.


All developers who use CloudKit handle data persistance on their own. Certainly Core Data would be the most popular choice but there is no single way to do that. There are way too many different scenarios (such as conflict resolution) that you have to handle with your own code depending on your data structure.

Thanks to all


Firstly I agree with Mr. Brightside, this is probably the most popular question and that there are multiple ways to address it.


Based on the 231 session and repeated locally cached reference and the fact that CloudKit and Core Data are the Apple preferred methods/frameworks to store database type data.


Why is there no means to have CloudKit data locally cached by Core Data

For iOS 11 perhaps this could be the next big deal. A Means to use CloudKit where the Internet is NOT always available.


After all Apple sells iPads without 4G and WiFi Only. However not all places have WiFi

So there are many cases where the Internet is NOT available.

So currently apps become useless if using CloudKit because there is no access to the CloudKit servers.

Even When a 4G device is in Airplane Mode, apps now become useless because again no access to the servers


Apple Please address this issue

>Apple Please address this issue


Intel formed a team in 2002 tasked with finding a way to accomplish offline access to cloud/shared data for laptops not connected to the 'net/each other, and soon learned there was little to do but cache local (with whatever warts that entailed) until connection was re-established.


It is now 2016, Apple is still pushing iCloud and if you think this is just about data, think again. Who knows why CK (not a fan) seems to be missing local caches, but I'd speculate that Apple is aiming to recoup their investment in server farms by pushing users to stay connected to (subscription based) remote content warehouses, so they can buy more (subscription based) music/apps/movies. Out of storage on your device? Buy (subscription based) storage and live off the cloud... Everyone wants to be subscription based - look how well it worked out for MS. Build it, make it hard to live without, and they won't have any choice but to eventually spend money on it.


Either a device is connected, or not, and it is up to the individual user to decide just how important their data/content/access is. When modern access is mandated, be sure to work with a connected device, since not being connected is, well, so 2002.


But as always, forum posts are not bug reports/feature requests, so feel free to reach out to Apple directly via the Report Bugs link, below right, every page here for things you'd like to see going forward.


Good luck.


Ken

hey thanks for complete ignoring my suggestion...