Hide Runtime Notification Action Button

I registered for push and local notifications using two action buttons: action1 and action2. Upon receiving the notification, I can see both of them, and also take measures depending on the identifier of the action. However, one of my use cases requires that I hide one or both action buttons before planning a local notification. Can I do this at runtime?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

In this method, I register for notifications using two action buttons.

I see that depending on the context, we can define a variable number of action buttons. However, the context is predefined and not defined by the user.

+5
source share
1 answer

Register a user notification with several categories as you need, for example category1 with two actions , category2 without actio n, category3 with only one action.

When creating a local notification, use a specific category as necessary. like this notificationName.category = @ "Category_identifier";

+1
source

Source: https://habr.com/ru/post/1260490/


All Articles