AUNotificationService

open class AUNotificationService : UNNotificationServiceExtension

Attaches a media (image, sound, or video) item to a remote notification before it’s delivered to the user.

The media will be downloaded from a URL specified in the incoming notification. The format of the notification payload and name of the field containing the image URL is specified in payloadSchema, which conforms to AUNotificationPayload.

  • Defines the format of incomming notification payloads.

    You can override the default value in the initializer of a child class.

    Default: PinpointNotificationPayload

    Declaration

    Swift

    public var payloadSchema: AUNotificationPayload.Type
  • The content handler for the notification.

    Declaration

    Swift

    public var contentHandler: ((UNNotificationContent) -> Void)?
  • The content for the notification.

    Declaration

    Swift

    public var bestAttemptContent: UNMutableNotificationContent?
  • Called when in incomming notification is received. Allows modification of the notification request before delivery.

    Declaration

    Swift

    open override func didReceive(
        _ request: UNNotificationRequest,
        withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
    )

    Parameters

    request

    The original notification request. Use this object to get the original content of the notification.

    contentHandler

    The block to execute with the modified content.

  • Called when the system is terminating the extension.

    Declaration

    Swift

    open override func serviceExtensionTimeWillExpire()