当任何应用程序交付或激活NSUserNotification时,如何通知我?
NSDistributedNotificationCenter发送的任何东西,NSUserNotificationDeliveredMask这样的面具,我可以注册一个全局[NSEvent addGlobalMonitorForEventsMatchingMask],[NSUserNotificationCenter defaultCenter]及其委托只在我自己的应用程序发送通知时通知我。
发布于 2015-04-17 21:08:42
This answer应该解决如何接收来自NSDistributedNotificationCenter的可用通知。不过,据我所知,doesn't seem to be any way会得到所有的NSUsernotifications。
发布于 2015-04-18 13:15:41
这是不可能的。您只能侦听“全局”通知的NSDistributedNotificationCenter。应用程序开发人员必须向NSDistributedNotificationCenter广播,以使您能够连接到它。
您不能劫持其他应用程序通知。大多数应用程序和通过apps分发的所有应用程序都是沙箱的。它的本质限制了你与它们挂钩的能力!
https://stackoverflow.com/questions/15566761
复制相似问题