The abstract base class for CloudKit notifications.


class CKNotification : NSObject


Notification objects wrap the data associated with a push notification. Use notification objects to wrap recently received push notification data or to fetch notification objects representing already delivered push notifications from a container. In both cases, the information in the notification object tells you what changed.

The CKNotification class itself is an abstract class. When you create a new notification object from a payload dictionary, the init(fromRemoteNotificationDictionary:) method instantiates a subclass of the appropriate type. Similarly, when you fetch notifications from a container, what you receive are instances of a concrete subclass. The base CKNotification class provides information about the push notification and how it was delivered. Specific subclasses contain specific data indicating what change actually occurred.


Creating a Notification Object

init?(fromRemoteNotificationDictionary: [AnyHashable : Any])

Creates and returns a new notification object using the specified payload data.

Identifying the Notification Object

var notificationID: CKNotification.ID?

The ID of the notification.

var notificationType: CKNotification.NotificationType

The type of event that generated the notification.

var containerIdentifier: String?

The ID of the container whose content triggered the notification.

Getting the Notification Status

var isPruned: Bool

A Boolean value indicating whether some push notification content was removed prior to delivery.

Accessing the Notification Info

var alertBody: String?

The text of the alert message.

var alertLocalizationKey: String?

The key that identifies the localized string to use for the alert message.

var alertLocalizationArgs: [String]?

The array of fields used to build the alert message

var alertActionLocalizationKey: String?

The key that identifies the text to use for the action button in the alert panel.

var alertLaunchImage: String?

The filename of the launch image displayed when your app is launched from the push notification alert.

var soundName: String?

The name of the sound file to play when a notification arrives.

var badge: NSNumber?

The current badge value.

var category: String?

Name of the action group corresponding to this notification.


enum CKNotification.NotificationType

Constants indicating the type of event that generated the push notification.


class CKNotification.ID

An object that uniquely identifies a push notification sent from a container.


Inherits From

Conforms To

See Also


class CKQueryNotification

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software