NSUserNotification not showing action button

前端 未结 4 1391
梦毁少年i
梦毁少年i 2021-01-30 16:47

I\'m using this code:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
    NSUserNo         


        
4条回答
  •  长情又很酷
    2021-01-30 17:15

    As already stated in a previous answer, the notification type needs to be set to alert for the action button to be shown. If you want to set the default notification style of your app to alert, you need to define the key NSUserNotificationAlertStyle in info.plist with the value alert.

    See Apple's info.plist keys reference for more details:

    NSUserNotificationAlertStyle Specifies whether the notification style should be banners, alerts, or none. The default value is banners, which is the recommended style.

提交回复
热议问题