How does Apple think an App should be initiliazed with data from the public database?

I'd like to use CloudKit for my app in order to store data in the public database, which would be pre-loaded by me with around10-20k records prior to app launch, with a fluctuation rate of maybe 200/week going in and out, so the total number is expected to be more or less constant.


My question is: how does Apple think a device that comes in say 6 month after app launch is supposed to get the current set of data from the public database??


As we all know, the relevant methods that fetch records in bulk and return a serverChangeToken only work on custom zones, which cannot be created in the public db.

The only solution right now seems to be: Create a CKQuerySubscription for each record type, and run a CKFetchNotificationChangesOperation (whoch is deprecated, btw) at the apps first launch. Given the fluctuations above, that would mean processing around 5000 notification changes after 6 month for a new device to be up to date, i.e. before the user can do anything with the new app.

The only hack that I can think of to work around this problem is to periodically create a snapshot of the data and the serverChangeToken and download that snapshot as a starting point.


Does anyone know of a better solution? Thanks in advance for any help, and apologies if this topic has been discussed before.

Replies

One option to consider is to run a CKQueryOperation with desiredKeys set to just the properties you want. For e.g. recordName and createdAt, modifiedAt. This way you'll at least get an idea of which records were created/modified recently, and then you can initiate another queryoperation to download the full records for only those recordIDs. Just a hunch; I have no idea if it'll work out or not.