A definition of a type of notification that your app supports and the custom actions to display with it.
- iOS 10.0+
- watchOS 3.0+
UNNotification object defines a type of notification that your executable can receive. You use category objects to implement 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.
You create category objects using the
init(identifier: method and register them using the singleton
UNUser object early in your executable’s life cycle. You can register as many category objects as you want. To take advantage of category objects, include the category’s identifier string in the payload of any notifications you create. For local notifications, you put this string in the
category property of the
UNMutable object that you use to specify the notification’s content. For remote notifications, you use this string as the value of the
category key in the payload dictionary.
Categories can have associated actions, which when present define custom buttons displayed along with notifications of that category. Actions are stored in the
actions property. When space is not limited, the system displays up to ten actions. When space is limited, the system displays at most two actions.