An object that represents a push notification that was generated by a subscription object.


class CKQueryNotification : CKNotification


Subscription objects represent persistent queries on the server. When the server detects a change related to a subscription, it sends a push notification to the client that created the subscription and logs the push notification in the container. You use instances of this class to get information about the record involved in the push notification.

You do not create instances of this class directly. When your app receives a push notification, call the init(fromRemoteNotificationDictionary:) method of CKNotification to generate a notification object of the appropriate type. You can fetch previously logged notifications from a container using a CKFetchNotificationChangesOperation object. If the notification was triggered due to a subscription object, you receive an instance of this class with its notificationType property set to CKNotification.NotificationType.query. Use that object to retrieve the record-related information.

If a push notification’s payload is too large, pieces of data may be dropped until it is under the allowed size limit. The data used to alert the user is the most important and is dropped last. Data values in this class are among the first to be dropped, with values being dropped in the following order:

  1. containerIdentifier—defined in the CKNotification class.

  2. recordID

  3. queryNotificationReason

  4. recordFields

  5. Other properties of the CKNotification class.


Getting the Database Scope

Getting the Notification Attributes

var queryNotificationReason: CKQueryNotification.Reason

The event that triggered the delivery of the push notification.

Getting the Record Information

var isPublicDatabase: Bool

A Boolean value indicating whether the record is in the public database.

var recordID: CKRecord.ID?

The identifier of the record that was created, deleted, or updated.

var recordFields: [String : Any]?

A dictionary of the fields that changed.


enum CKQueryNotification.Reason

Constants indicating the event that triggered the notification.


Inherits From

Conforms To

See Also


class CKNotification

The abstract base class for CloudKit notifications.