UIUserNotificationAction not showing on device

Hello,


I got a very strange problem: UIUserNotifcationActions for my app do not show up on devices but show/work on Simulator.


Setup:

    UIMutableUserNotificationAction* replyToChat = [UIMutableUserNotificationAction new];
    replyToChat.activationMode = UIUserNotificationActivationModeForeground;
    replyToChat.title = @"Reply";
    replyToChat.identifier = @"replyToChat";
    replyToChat.destructive = NO;
    replyToChat.authenticationRequired = YES;

    UIMutableUserNotificationAction* ignoreChat = [UIMutableUserNotificationAction new];
    replyToChat.activationMode = UIUserNotificationActivationModeBackground;
    ignoreChat.title = @"Ignore";
    ignoreChat.identifier = @"ignoreChat";
    ignoreChat.destructive = YES;
    ignoreChat.authenticationRequired = NO;

    UIMutableUserNotificationCategory* catChat = [[UIMutableUserNotificationCategory alloc] init];
    catChat.identifier = @"myChat";
    [catChat setActions:@[replyToChat, ignoreChat] forContext:UIUserNotificationActionContextDefault];

    NSMutableSet *categories = [NSMutableSet setWithObject:catChat];

    UIUserNotificationSettings* notifySettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeSound|UIUserNotificationTypeBadge categories:categories];

    [[UIApplication sharedApplication] registerUserNotificationSettings:notifySettings];


Sending the local notification:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
  localNotification.alertBody = @"Test";
  localNotification.timeZone = [NSTimeZone defaultTimeZone];
   localNotification.category = @"myChat";

  [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];


I can see, that the settings are properly registered and I've implemented all the the -handleAction callbacks in my App delegate.


I can't finda reason why the buttons won't show up when sliding on device but show up in the Simulator. I've even done the complete notification settings reset according to https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42 without success.


Anybody got some ideas?


// Edit:
I'm testing with Watch in parallel, there it is the same behavior. On the Simulator, the buttons for the actions show up and work as expected, on the actual Watch, only the default 'Close' button is there. Log from didReceiveLocalNotification on the Watch NotificationController confirms, that the notification.category is properly set and equal to the value I pass in applicationDidFinishLaunching.

Answered by langaCom in 135387022

Solved.


If you work with notification categories, make sure you don't have some third party library included which overwrites your UINotificationSettings...

Accepted Answer

Solved.


If you work with notification categories, make sure you don't have some third party library included which overwrites your UINotificationSettings...

What if i do have some third party included, like Firebase Cloud Messaging?
UIUserNotificationAction not showing on device
 
 
Q