【问题标题】:Cocoa / NSUserNotificationCenter get all NSUserNotification notificationsCocoa / NSUserNotificationCenter 获取所有 NSUserNotification 通知
【发布时间】:2013-03-12 02:21:29
【问题描述】:

每当任何应用程序发送或激活NSUserNotification 时,如何通知我?

  • 我也无法确定通过NSDistributedNotificationCenter 发送的任何内容,
  • 我也找不到像 NSUserNotificationDeliveredMask [dummy name] 这样的掩码,我可以为全局注册一个 [NSEvent addGlobalMonitorForEventsMatchingMask]
  • 似乎也没有适合默认用户通知中心对象的观察者。

[NSUserNotificationCenter defaultCenter] 及其委托仅在我自己的应用发送通知时通知我。

【问题讨论】:

    标签: objective-c macos cocoa osx-mountain-lion nsusernotificationcenter


    【解决方案1】:

    This answer 应该说明如何接收来自NSDistributedNotificationCenter 的可用通知。不过,据我所知,doesn't seem to be any way 可以获取所有 NSUsernotifications

    【讨论】:

      【解决方案2】:

      这是不可能的。您只能收听 NSDistributedNotificationCenter 的“全局”通知。应用程序开发人员必须向NSDistributedNotificationCenter 广播,以便您参与其中。

      您不能劫持其他应用程序的通知。大多数应用程序和通过 App Store 分发的所有应用程序都是沙盒化的。这本身就限制了你吸引他们的能力!

      【讨论】:

        猜你喜欢
        • 2013-05-21
        • 2012-08-20
        • 2013-03-31
        • 2014-02-02
        • 1970-01-01
        • 1970-01-01
        • 2011-03-03
        • 2011-04-18
        • 2015-04-16
        相关资源
        最近更新 更多