UANotificationCategory

@interface UANotificationCategory : NSObject

Clone of UNNotificationCategory for iOS 8-9 support.

  • The name of the action group.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull identifier;

    Swift

    var identifier: String { get }
  • The actions to display when a notification of this type is presented.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<UANotificationAction *> *_Nonnull actions;

    Swift

    var actions: [UANotificationAction] { get }
  • The intents supported by notifications of this category.

    Note: This property is only applicable on iOS 10 and above.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<NSString *> *_Nonnull intentIdentifiers;

    Swift

    var intentIdentifiers: [String] { get }
  • A placeholder string to display when the user has disabled notification previews for the app.

    Note: This property is only applicable on iOS 11 and above.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nullable)
        NSString *hiddenPreviewsBodyPlaceholder;

    Swift

    var hiddenPreviewsBodyPlaceholder: String? { get }
  • A format string for a summary description when notifications from this category are grouped together.

    Note: This property is only applicable on iOS 12 and above.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *categorySummaryFormat;

    Swift

    var categorySummaryFormat: String? { get }
  • Options for how to handle notifications of this type.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) UANotificationCategoryOptions options;

    Swift

    var options: UANotificationCategoryOptions { get }
  • Creates a user notification category with the specified parameters.

    Declaration

    Objective-C

    + (nonnull instancetype)
        categoryWithIdentifier:(nonnull NSString *)identifier
                       actions:(nonnull NSArray<UANotificationAction *> *)actions
             intentIdentifiers:(nonnull NSArray<NSString *> *)intentIdentifiers
                       options:(UANotificationCategoryOptions)options;

    Swift

    convenience init(identifier: String, actions: [UANotificationAction], intentIdentifiers: [String], options: UANotificationCategoryOptions = [])

    Parameters

    identifier

    The category identifier

    actions

    An array of user notification actions

    intentIdentifiers

    The intents supported for notifications of this category.

    options

    Constants indicating how to handle notifications associated with this category.

    Return Value

    The user notification category created or nil if an error occurred.

  • Creates a user notification category with the specified parameters.

    Declaration

    Objective-C

    + (nonnull instancetype)
               categoryWithIdentifier:(nonnull NSString *)identifier
                              actions:
                                  (nonnull NSArray<UANotificationAction *> *)actions
                    intentIdentifiers:
                        (nonnull NSArray<NSString *> *)intentIdentifiers
        hiddenPreviewsBodyPlaceholder:
            (nullable NSString *)hiddenPreviewsBodyPlaceholder
                              options:(UANotificationCategoryOptions)options;

    Swift

    convenience init(identifier: String, actions: [UANotificationAction], intentIdentifiers: [String], hiddenPreviewsBodyPlaceholder: String?, options: UANotificationCategoryOptions = [])

    Parameters

    identifier

    The category identifier

    actions

    An array of user notification actions

    intentIdentifiers

    The intents supported for notifications of this category.

    hiddenPreviewsBodyPlaceholder

    A placeholder string to display when the user has disabled notification previews for the app.

    options

    Constants indicating how to handle notifications associated with this category.

    Return Value

    The user notification category created or nil if an error occurred.

    • Creates a user notification category with the specified parameters. *
    • - parameter: identifier The category identifier
    • - parameter: actions An array of user notification actions
    • - parameter: intentIdentifiers The intents supported for notifications of this category.
    • - parameter: hiddenPreviewsBodyPlaceholder A placeholder string to display when the user has disabled notification previews for the app.
    • - parameter: format A format string for a summary description when notifications from this category are grouped together
    • - parameter: options Constants indicating how to handle notifications associated with this category.
    • - returns: The user notification category created or nil if an error occurred.

    Declaration

    Objective-C

    + (nonnull instancetype)
               categoryWithIdentifier:(nonnull NSString *)identifier
                              actions:
                                  (nonnull NSArray<UANotificationAction *> *)actions
                    intentIdentifiers:
                        (nonnull NSArray<NSString *> *)intentIdentifiers
        hiddenPreviewsBodyPlaceholder:
            (nullable NSString *)hiddenPreviewsBodyPlaceholder
                categorySummaryFormat:(nullable NSString *)format
                              options:(UANotificationCategoryOptions)options;

    Swift

    convenience init(identifier: String, actions: [UANotificationAction], intentIdentifiers: [String], hiddenPreviewsBodyPlaceholder: String?, categorySummaryFormat format: String?, options: UANotificationCategoryOptions = [])

    Parameters

    identifier

    The category identifier

    actions

    An array of user notification actions

    intentIdentifiers

    The intents supported for notifications of this category.

    hiddenPreviewsBodyPlaceholder

    A placeholder string to display when the user has disabled notification previews for the app.

    format

    A format string for a summary description when notifications from this category are grouped together

    options

    Constants indicating how to handle notifications associated with this category.

    Return Value

    The user notification category created or nil if an error occurred.

  • Converts a UANotificationCategory into a UNNotificationCategory.

    Declaration

    Objective-C

    - (null_unspecified UNNotificationCategory *)asUNNotificationCategory;

    Return Value

    An instance of UNNotificationCategory.

  • Tests for equivalence with a UNNotificationCategory.

    Declaration

    Objective-C

    - (BOOL)isEqualToUNNotificationCategory:
        (nonnull UNNotificationCategory *)category;

    Parameters

    category

    The UNNotificationCategory to compare with.

    Return Value

    YES if the two categories are equivalent, NO otherwise.