Class

UIMutableUserNotificationAction

Important: UIMutableUserNotificationAction is deprecated in iOS 10. Use UNNotificationAction instead. A UIMutableUserNotificationAction object represents a modifiable version of the UIUserNotificationAction class.

Overview

When a notification is delivered, the system displays a button for each custom action associated with the notification. Tapping a button launches your app (either in the foreground or background) and gives you a chance to perform the indicated action. You use this class to configure the details about the button that is displayed and the information your app needs to perform the corresponding action.

To associate custom actions with a local or remote notification, create one or more instances of this class and use them to configure one or more UIMutableUserNotificationActionSettings objects. An action settings objects defines the set of actions to associate with a single notification. You register your app’s action settings objects at launch time, along with your app’s preferred notification options, using a UIUserNotificationSettings object.

For each action you define, you must specify whether execution of that action requires the app to be running in the foreground or background. You can also specify whether the device must be unlocked or can remain locked while the action is performed. Unlocking the device may be necessary if the action involves reading or writing files that are encrypted on disk using the system’s data protection mechanism. When the user selects an action, the system puts your app into the appropriate mode and calls your app delegate’s application(_:handleActionWithIdentifier:forRemoteNotification:completionHandler:) or application(_:handleActionWithIdentifier:for:completionHandler:) method to perform the action.

Symbols

Getting the Action Information

var identifier: String?

The string that you use internally to identify the action.

var title: String?

The localized string to use as the button title for the action.

Configuring the Action’s Behavior

var activationMode: UIUserNotificationActivationMode

The mode in which to run the app when the action is performed.

var isAuthenticationRequired: Bool

A Boolean value indicating whether the user must unlock the device before the action is performed.

var isDestructive: Bool

A Boolean value indicating whether the action is destructive.

var behavior: UIUserNotificationActionBehavior

The custom behavior (if any) that the action supports.

var parameters: [AnyHashable : Any]

A dictionary of additional parameters to include with the action.

Relationships