A task to perform in response to a delivered notification.
- iOS 10.0+
- macOS 10.14+
- watchOS 3.0+
UNNotification objects to define the actions that your app can perform in response to a delivered notification. You define the actions that your app supports. For example, a meeting app might define actions for accepting or rejecting a meeting invitation. The action object itself contains the title to display in an action button and the button's appearance. After creating action objects, add them to a
UNNotification object and register your categories with the system.
For information on how to define actions and categories, see Declaring Your Actionable Notification Types.
Responding to the Selection of Actions
When the user selects one of your actions in response to a notification, the system notifies the delegate of the shared
UNUser object. Specifically, the system calls the
user method of your delegate object. The response object passed to your delegate includes the
identifier string of the action that was selected, which you can use to perform the corresponding task.
For information on how to handle actions, see Handling Notifications and Notification-Related Actions.