Notification Category: What It Is, What Categories Exist and How They Work in iOS

Author: IT Sectr Published: 2026-03-20 Reading time: 8 min

Notification Category is an iOS mechanism for grouping push notifications by type and attaching custom actions to them. The category determines which buttons are displayed when using 3D Touch or long-press on a notification, as well as how the system processes incoming notifications of this type. According to Apple Developer Documentation, UNNotificationCategory is registered in UNUserNotificationCenter and linked to a notification via the category field in the APNS payload.

Key Takeaways

  • Notification Category — an iOS mechanism for classifying push notifications and adding actions to them
  • UNNotificationCategory — a class that registers a category with a set of UNNotificationAction
  • Actions — buttons under the notification: UNTextInputAction for text input, UNNotificationAction for tap
  • Connection — the category is specified in the APNS payload via the category key in the aps dictionary
  • Difference from Android — iOS Category manages actions, while Android Channel manages importance and sound

What Is Notification Category in iOS?

Notification Category is an iOS feature (since version 8.0) that allows developers to classify push notifications and add interactive actions to them. When a user receives a notification and presses firmly (3D Touch) or performs a long-press, buttons appear that are defined by the category. This makes notifications interactive and allows users to take action without opening the app.

A category is registered using a UNNotificationCategory object, which contains an identifier, an array of actions, and optional display parameters. The system uses the category identifier from the APNS payload to find the registered category and display the corresponding buttons.

Unlike Android Notification Channel, iOS Category does not manage importance, sound, or vibration. Its sole purpose is to provide interactive capabilities for notifications: reply, confirm, cancel, or text input buttons.

Are Categories Mandatory?

Categories are not mandatory for displaying push notifications on iOS. The notification will appear regardless — with buttons if a category is registered, or without them. Categories are only needed to add interactivity to notifications.

How Do Notification Categories Work?

The category mechanism consists of four stages: registering the category on the client, sending an APNS payload with the category, the system recognizing the category, and handling the user action.

  • Registration — the app creates a UNNotificationCategory with an array of actions and registers it in UNUserNotificationCenter
  • Sending — the server includes the category key in the APNS payload with a value matching the category identifier
  • Display — iOS shows the notification and on force touch displays the buttons associated with the category
  • Handling — the user taps a button, triggering UNUserNotificationCenterDelegate.didReceive response

Actions in a category can be of two types: foreground (open the app) and background (execute in the background). For background actions, the app gets limited time (about 30 seconds) to process in UNNotificationActionHandler.

Options When Registering a Category

UNNotificationCategory supports several options via the options parameter: customDismissAction — receive an event when the notification is swiped away, allowInCarPlay — show actions in CarPlay, hiddenPreviewsBodyPlaceholder — custom placeholder text for hidden previews.

UNNotificationAction: Action Types

iOS provides two types of actions for notification categories. Each type has its own purpose and way of interacting with the user.

TypeClassDescriptionExample
Simple ActionUNNotificationActionA button with a title and options (destructive, foreground, authenticationRequired)“Delete”, “View”
Text InputUNTextInputActionA button that opens a text input field with a placeholder“Reply”, “Comment”

UNTextInputAction is a unique iOS feature. When the user taps the “Reply” button, the system shows a text field where the user types their response. The entered text is passed to the delegate along with the action identifier. This allows implementing quick replies without opening the app.

Action options: options.authenticationRequired — requires device unlock, options.destructive — highlights the button in red (for dangerous actions), options.foreground — opens the app after tapping.

Setting Up a Category in iOS Code

Categories are registered at app launch, typically in the didFinishLaunchingWithOptions method. Registration is done through UNUserNotificationCenter, after requesting notification permission. Categories can be updated on every launch — old versions are replaced with new ones.

swift
import UserNotifications

class AppDelegate: UIResponder, UIApplicationDelegate {

    func registerNotificationCategories() {
        let replyAction = UNTextInputNotificationAction(
            identifier: "reply",
            title: "Reply",
            options: [.foreground],
            textInputButtonTitle: "Send",
            textInputPlaceholder: "Enter message..."
        )

        let deleteAction = UNNotificationAction(
            identifier: "delete",
            title: "Delete",
            options: [.destructive]
        )

        let messageCategory = UNNotificationCategory(
            identifier: "message",
            actions: [replyAction, deleteAction],
            intentIdentifiers: [],
            options: [.customDismissAction]
        )

        UNUserNotificationCenter.current()
            .setNotificationCategories([messageCategory])
    }

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        UNUserNotificationCenter.current().delegate = self
        registerNotificationCategories()
        return true
    }
}

After registering the category, any notification with category = “message” in the APNS payload will show the “Reply” and “Delete” buttons. Handling taps happens in userNotificationCenter:didReceive response, where actionIdentifier determines which button was pressed.

Handling Taps in the Delegate

When the user taps a category button, iOS calls the UNUserNotificationCenterDelegate with a UNNotificationResponse object. The response.actionIdentifier contains the identifier of the tapped button, and response.notification.request.content.userInfo contains custom data from the payload.

Differences from Android Channels

Developers familiar with Android Notification Channels often confuse them with iOS Notification Categories. Despite the similar name, these mechanisms solve different tasks and work differently.

  • Purpose — Android Channels manage notification importance and visibility; iOS Categories manage interactive actions
  • Mandatory — Android Channel is required to show a notification; iOS Category is optional
  • User Control — Android users configure channels in system settings; iOS categories are not directly visible to users
  • Grouping — Android Channels can be grouped into ChannelGroups; iOS Categories are not grouped

Both platforms can combine both mechanisms: on Android, a notification can belong to a channel with actions from NotificationCompat, while on iOS, a category complements channels, which are called thread-id in iOS and serve to group notifications in the notification center.

APNS Payload with Category

For a notification to display with category buttons, the server must include the category key in the APNS payload. Without this key, the system will not know which category to apply to the notification.

json
{
    "aps": {
        "alert": {
            "title": "New Message",
            "body": "Anna: Hi! How are you?"
        },
        "category": "message",
        "thread-id": "chat_123",
        "badge": 5,
        "sound": "default"
    }
}

The category key must exactly match the identifier registered via setNotificationCategories on the client. Case matters — “message” and “Message” are considered different categories. If the category is not found, the notification appears without buttons, with no errors in the logs.

Handling Unknown Categories

If the server sends a notification with a category that is not registered on the client, iOS ignores the category and shows the notification without buttons. The error is not logged, and the app does not learn about the mismatch. It is recommended to synchronize the category list between the server and the client.

Category Design Patterns

When designing notification categories in iOS, follow the principle of one category — one scenario. Each category should correspond to a specific type of interaction: replying to a message, confirming an action, or declining a request. Do not mix different scenarios in a single category.

Use UNTextInputAction for scenarios where the user needs to enter text without opening the app: messaging replies, comments, quick notes. Text actions increase engagement — the user performs a meaningful action in 2 taps instead of 5+ in the app.

For dangerous actions (delete, block), use the destructive option. iOS will highlight these buttons in red, warning the user about the irreversibility of the action. For actions that require device unlock (viewing personal data), specify authenticationRequired.

Test categories on different devices: on iPhone with 3D Touch, on iPhone without 3D Touch (long-press), on iPad, and on Mac. Category behavior may differ slightly across Apple platforms. Special attention to CarPlay: category buttons appear on the car screen and should be designed with minimal text for driver safety.

Frequently Asked Questions

How many categories can be registered in iOS?

There are no limits — iOS does not impose a limit on the number of UNNotificationCategory instances. However, in practice, it is recommended to use no more than 10–15 categories to avoid complicating delegate handling. Each category can contain up to 4 actions (buttons). More than 4 actions are ignored by the system.

How to handle a category button tap?

Implement the UNUserNotificationCenterDelegate protocol and the didReceive method. Check response.actionIdentifier: UNNotificationDismissActionIdentifier — swipe to dismiss, UNNotificationDefaultActionIdentifier — tap on the body, or your custom button identifier. For text input buttons, the text is available via response.userText.

How does category differ from thread-id?

Category — defines interactive actions (buttons) for the notification. Thread-id — groups notifications in the Notification Center by topic. Both keys are specified in the APNS payload. Category and thread-id are unrelated: a notification can have a category but no thread-id, and vice versa.

Do categories work on macOS?

Yes, UNNotificationCategory is supported on macOS 10.14+ (Mojave) in apps using the UserNotifications framework. Category behavior on macOS is similar to iOS: when clicking on a notification, buttons are shown, and handling is done through UNUserNotificationCenterDelegate.

Do I need to update categories on every launch?

It is recommended to register categories on every app launch via setNotificationCategories. The system replaces the old set of categories with the new one on each call. If you do not update, categories persist between launches, but when the code changes, old categories may cause unexpected behavior.

Summary

  • Notification Category — an iOS mechanism for adding interactive actions to push notifications
  • UNNotificationCategory — a class that combines an identifier, an array of UNNotificationAction, and options
  • UNTextInputAction — an action with a text input field for quick replies without opening the app
  • APNS Payload — the category key in the aps dictionary links the notification to a registered category
  • Up to 4 actions — maximum buttons per category, the rest are ignored by the system
  • Action Options — foreground (open the app), destructive (red button), authenticationRequired
  • Difference from Android — iOS Category handles actions, Android Channel handles importance and sound

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project

Read also