Protocol

UNUserNotificationCenterDelegate

The interface for handling incoming notifications and notification-related actions.

Overview

Use the methods of the UNUserNotificationCenterDelegate protocol to handle user-selected actions from notifications, and to process notifications that arrive when your app is running in the foreground. After implementing these methods in an object, assign that object to the delegate property of the shared UNUserNotificationCenter object. The user notification center object calls the methods of your delegate at appropriate times.

For information about the shared user notification center object, see UNUserNotificationCenter.

Topics

First Steps

Handling Notifications and Notification-Related Actions

Respond to user interactions with the system’s notification interfaces, including handling your app's custom actions.

Handling the Selection of Custom Actions

Receiving Notifications

func userNotificationCenter(UNUserNotificationCenter, willPresent: UNNotification, withCompletionHandler: (UNNotificationPresentationOptions) -> Void)

Asks the delegate how to handle a notification that arrived while the app was running in the foreground.

struct UNNotificationPresentationOptions

Constants indicating how to present a notification in a foreground app.

Displaying Notification Settings

func userNotificationCenter(UNUserNotificationCenter, openSettingsFor: UNNotification?)

Asks the delegate to display the in-app notification settings.

Beta

Relationships

Inherits From

See Also

Notification Management

class UNUserNotificationCenter

The central object for managing notification-related activities for your app or app extension.

class UNNotificationSettings

The object for managing notification-related settings and the authorization status of your app.

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