Search code examples
ioscloudkitcksubscriptioncknotification

How is it possible that CKQueryNotification reason is RecordUpdated but recordFields is nil?


println("queryNotification.recordFields.keys: \(queryNotification.recordFields?.keys)")

I do not catch how it this log possible? If I get a notification that record was updated, than I need at least one field that was changed, isn't it? Btw I am changing one field on an other device, so I do not see the reason why recordFields is nil, it should have at least one key-value.

enter image description here

enum CKQueryNotificationReason : Int {
    case RecordCreated
    case RecordUpdated
    case RecordDeleted
}

Solution

  • Need to set desiredKeys when subscription being created.

    subscription.notificationInfo.desiredKeys = ["neededField"]