我的应用程序安排了通知并很好地显示了
NSUserNotificationCenter.default.delegate = self
let notification = NSUserNotification()
notification.deliveryDate = Date(timeIntervalSinceNow: TimeInterval(10))
notification.title = title
notification.actionButtonTitle = "Do something"
notification.soundName = notificationSound != "none" ? notificationSound : nil
notification.otherButtonTitle = "Close"
NSUserNotificationCenter.default.scheduleNotification(notification)
当我按下按钮时,激活方法叫好
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
DDLogDebug("Did activate notification")
switch notification.activationType {
...
}
问题是打开的窗口在按下不需要的窗口后被激活。
应用程序是具有多个打开的窗口的代理程序(UIElement)。尝试过非代理应用程序,问题仍然存在-它会激活主窗口
有什么想法吗?
更新
很遗憾,我没有找到答案。我实现了自己的显示自定义面板的通知机制