iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference UIUserNotificationAction Class Reference

Options
Deployment Target:

On This Page
Language:

UIUserNotificationAction

A UIUserNotificationAction object represents a custom action that your app can perform in response to a remote or local notification. 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 specify the text that is displayed in the button and the information your app needs to perform the corresponding action. More...

Inheritance


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 8.0 and later.
  • The mode in which to run the app when the action is performed. (read-only)

    Declaration

    Swift

    var activationMode: UIUserNotificationActivationMode { get }

    Objective-C

    @property(nonatomic, assign, readonly) UIUserNotificationActivationMode activationMode

    Discussion

    If the value in this property is UIUserNotificationActivationModeForeground, the value of the isAuthenticationRequired property is assumed to be YEStrue regardless of its actual value.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • A Boolean value indicating whether the user must unlock the device before the action is performed. (read-only)

    Declaration

    Swift

    var authenticationRequired: Bool { get }

    Objective-C

    @property(nonatomic, assign, readonly, getter=isAuthenticationRequired) BOOL authenticationRequired

    Discussion

    The value of this property is ignored and treated as a value of YEStrue when the value of the activationMode property is set to UIUserNotificationActivationModeForeground.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • A Boolean value indicating whether the action is destructive. (read-only)

    Declaration

    Swift

    var destructive: Bool { get }

    Objective-C

    @property(nonatomic, assign, readonly, getter=isDestructive) BOOL destructive

    Discussion

    Use this property to signal to the user whether the action causes destructive behavior to the user’s data or the app. When the value of this property is YEStrue, the system displays the corresponding button differently to indicate that the action is destructive.

    The default value of this property is NOfalse.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Constants indicating whether the app should activate to the foreground or background.

    Declaration

    Swift

    enum UIUserNotificationActivationMode : UInt { case Foreground case Background }

    Objective-C

    typedef enum UIUserNotificationActivationMode : NSUInteger { UIUserNotificationActivationModeForeground, UIUserNotificationActivationModeBackground } UIUserNotificationActivationMode;

    Constants

    • Foreground

      UIUserNotificationActivationModeForeground

      Activate the app and put it in the foreground.

      Available in iOS 8.0 and later.

    • Background

      UIUserNotificationActivationModeBackground

      Activate the app and put it in the background. If the app is already in the foreground, it remains in the foreground.

      Available in iOS 8.0 and later.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.