Outdated CKRecord on NSPersistentCloudKitContainer.record(for:)

Hi,

I am trying to fetch CKShare for NSManagedObject. Firstly I get CKRecord for it using NSPersistentCloudKitContainer's record(for:) method. And getting situation when:
  1. First time record(for:) gives correct CKRecord

  2. I successfully create CKShare, see it in online Dashboard

  3. Next time record(for:) gives old CKRecord which don't have share yet, it's outdated!

  4. I swipe down notification Notification Center or minimise the app (go to home screen), and when go back, database is being immediately updated and record(for:) returns correct CKRecord with existing share now.

I can get correct CKRecord if I use only recordID from CKRecord that I get from record(for:), and fetch updated CKRecord using fetch(withRecordID:completionHandler:).

But it increase awaiting time twice because I need to get response for correct CKRecord and then fetch CKShare for it. If no share for CKRecord, I could get that nil immediately but now I have to fetch correct updated CKRecord.

So, anyone know how to keep local database updated as expected without call Notification Center or minimising an app?
Outdated CKRecord on NSPersistentCloudKitContainer.record(for:)
 
 
Q