Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 获取用户';s NSUserNotificationCenter_Macos_Push Notification_Badge - Fatal编程技术网

Macos 获取用户';s NSUserNotificationCenter

Macos 获取用户';s NSUserNotificationCenter,macos,push-notification,badge,Macos,Push Notification,Badge,我正在开发一个接收推送通知的Mac应用程序,我希望保持徽章号与用户通知中心中的消息数同步 NSMutableArray *allNotifications = [NSMutableArray array]; [allNotifications addObjectsFromArray:[[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]]; [allNotifications addObj

我正在开发一个接收推送通知的Mac应用程序,我希望保持徽章号与用户通知中心中的消息数同步

NSMutableArray *allNotifications = [NSMutableArray array];
[allNotifications addObjectsFromArray:[[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]];
[allNotifications addObjectsFromArray:[[NSUserNotificationCenter defaultUserNotificationCenter] scheduledNotifications]];
当我轮询NSUserNotificationCenter的已传递和计划通知时,我收到0个对象,尽管我的通知中心中有2条可见消息

NSMutableArray *allNotifications = [NSMutableArray array];
[allNotifications addObjectsFromArray:[[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]];
[allNotifications addObjectsFromArray:[[NSUserNotificationCenter defaultUserNotificationCenter] scheduledNotifications]];
是否有不同的推送通知通知中心