Class

CKNotification

The abstract base class for CloudKit notifications.

Overview

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.

Topics

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: CKNotificationID?

The ID of the notification.

var notificationType: CKNotificationType

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.

var subscriptionID: String?

The identifier of the subscription that caused this notification to fire.

Constants

enum CKNotificationType

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

Relationships

Inherits From

Conforms To

See Also

Notifications

class CKQueryNotification

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