Class

UNNotificationCategory

A type of notification that your app supports and the custom actions to display with it.

Declaration

@interface UNNotificationCategory : NSObject

Overview

A UNNotificationCategory object defines a type of notification that your executable can receive. You create category objects to define your app's actionable notifications—that is, notifications that have action buttons that the user can select in response to the notification. Each category object you create stores the actions and other behaviors associated with a specific type of notification. Register your category objects using the setNotificationCategories: method of UNUserNotificationCenter. You can register as many category objects as you want.

To apply category objects to your notifications, include the category’s identifier string in the payload of any notifications you create. For local notifications, put this string in the categoryIdentifier property of the UNMutableNotificationContent object that you use to specify the notification’s content. For remote notifications, use this string as the value of the category key in the aps dictionary of your payload.

Categories can have associated actions, which define custom buttons to display for notifications of that category. When space is unlimited, the system displays up to 10 actions. When space is limited, the system displays at most two actions.

Topics

Creating a Notification Category

+ categoryWithIdentifier:actions:intentIdentifiers:options:

Creates a category object containing the specified actions and options.

+ categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:

Creates a category object containing the specified actions, options, and a hidden previous placeholder.

+ categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:categorySummaryFormat:options:

Creates a category object containing the specified actions and options, a hidden previous placeholder, and the category’s summary format string.

Getting the Category Information

identifier

The unique string assigned to the category.

actions

The actions to display when a notification of this type is presented.

intentIdentifiers

The intents related to notifications of this category.

hiddenPreviewsBodyPlaceholder

The placeholder text to display when notification previews are disabled for the app.

categorySummaryFormat

A format string for the summary description used when the system groups the category’s notifications.

Getting the Category Options

options

Options for how to handle notifications of this type.

UNNotificationCategoryOptions

Constants indicating how to handle notifications associated with this category.

Relationships

Inherits From

See Also

Notification Categories and User Actions

Declaring Your Actionable Notification Types

Differentiate your notifications and add action buttons to the notification interface.

UNNotificationAction

A task to perform in response to a delivered notification.

UNTextInputNotificationAction

An action that can accept user-typed text.