Abhishek
Abhishek

Reputation: 882

How to use same UNNotificationContentExtension with different UNNotificationAction?

I want to create UNNotificationContentExtension to show some custom UI. For this, I have to create some category for UNNotificationContentExtension and use it as categoryIdentifier while scheduling notification. I also want to add some actions with this rich notification, which I have done with

let category = UNNotificationCategory(identifier: notificationContentCategory, actions: [firstAction, secondAction, thirdAction, fourthAction], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])

Now the as per new app requirement, These rich notifications should have a different set of actions for different conditions. So as far as I can understand, There is no way to associate different set of actions to same UNNotificationContentExtension. Is there any way to associate different set of actions to same UNNotificationContentExtension ?

I am working with local notifications only.

Upvotes: 1

Views: 515

Answers (1)

Abhishek
Abhishek

Reputation: 882

Found solution for this. We can add array of identifiers in UNNotificationExtensionCategory attribute of info.plist in Notification content extension. Add all the identifiers here.

Upvotes: 1

Related Questions