Search code examples
swiftcloudkit

Record update push notification sent before assets upload in an iCloud database


I'm developing a CloudKit based sync capability in my iOS app. I have records with as Asset field, and I created a subscription to get push notifications when records are created, deleted or updated. The notifications are sent without a problem, and I receive them and sync.

The problem is with records that have a large asset. The client that is syncing receives the notification, fetches the record, but the asset has not been uploaded yet by CloudKit, so the result is an incomplete record.

Does anyone have any suggestions on how to deal with this situation? Am I doing something wrong here?

Any advice would be appreciated!


Solution

  • Perhaps there is something useful in CKQueryNotification.recordFields?

    I would check them both in create and update events for the record.

    Also, perhaps you can configure a separate subscription for the asset field via CKNotificationInfo.desiredKeys