I'm building an iOS app that heavily relies in CloudKit as a data source.
After installing the app and running it for the first time, I need to download a great amount of data that resides in the public database of my CloudKit Container. I do this with the CKFetchNotificationChangesOperation
This operation runs every time I launch the app to check for data changes since the last server change token I received. Obviously, on the first launch of the app, the change token I have to provide is nil, which would cause the CKFetchNotificationChangesOperation
to load ALL changes ever occurred on the database.
The data that is then returned will be stored locally as my desire is to have a local cache of all data relevant for my user. I store this data in a Core Data Database. As the data set the app needs when first launching might be big, I really need CKFetchNotificationChangesOperation to fetch ALL Changes on the server.\
This however, seems unreliable. When testing this service with some data I entered in my database, I don't receive all data I'm supposed to receive.
As I enter more data in my public database, the CKFetchNotificationChangesOperation
seems to completely ignore the records that I entered before. Sometimes, some slip through but it is very unreliable.
Obviously, I have verified that my subscriptions are legit (the same records got loaded before), and I have checked whether the moreComing
parameter of the CKFetchNotificationChangesOperation
is true (It is always false
)
Question
What should I do to get ALL data in my public database on an initial load? I thought that CKFetchNotificationChangesOperation
was supposed to do the job, but it seems unreliable. Is there anything like a 'scope' that I can configure on this operation to force it to load all my data? Or is CKFetchNotificationChangesOperation
not fit for initial loads and should I just load all data I need through custom operations?