InstallApplicatonEventHandler/NSNotificationCenter 不通知事件 (NS
InstallApplicatonEventHandler/NSNotificationCenter doesnt notify events (NSN)
我想在mac os中注册时间更改通知。我尝试了ApplicaitonEventHandler api,它似乎是这种情况的api,但我没有收到任何事件的通知
代码共享于,
https://gist.github.com/anonymous/a0b3e24e02b844bfb11e2b5d02e47d83
我注册了所有可能的事件,但触发任何事件似乎并没有为我创建通知。
我正在使用 .mm 扩展名,因为我希望我的代码公开为 c 样式的 api,并且如果可能的话,我可以与私有目标 c 类互操作(即如果目标 c 对象可以在 c++ 方法中实例化并且合适的目标 c api 可用于此类通知(。
[注意] 使用了下面建议的 NSNotization,它也不会发送任何通知。
如果你只想在时钟更改时收到通知,你可以收听com.apple.MenuBarClock.ClockNotification。
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(timeChanged:) name:@"com.apple.MenuBarClock.ClockNotification" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
相关文章:
- Android NDK传感器向事件队列报告奇怪的间隔
- 从文本文件中读取时钟时间和事件时间并进行处理
- WMI检测进程创建事件-c++
- EvtExportLogneneneba API正在将远程计算机的事件日志保存到远程PC本身.如何将其保存到主机
- 处理闪烁窗口事件
- C++Builder中的OnClick事件签名存在问题
- 跟踪滚动条上的鼠标事件
- 什么是事件表 (wxWidgets)?
- 如何在 MFCaptureEngine 中获取"Camera removed"事件
- 给定顺序中的事件处理
- 当服务中的事件被触发时,如何将响应从服务发送回客户端?
- 在 C++/CLI 中将 .NET 事件从一个 DLL 引发到另一个 DLL
- 如何创建事件驱动的 SDL2 应用程序
- Windows 进程间同步类似事件?
- 如何从C++端挂接到 QML 项的 onClick 事件
- 如何通过多类"Union variable" (sfml) 使用轮询事件
- 如何在Qt 4.8中阻止/忽略/丢弃早于特定超时的用户输入事件
- C++ 信号和插槽不工作:插槽不响应事件
- 在虚幻引擎中触发C++ dll的事件
- InstallApplicatonEventHandler/NSNotificationCenter 不通知事件 (NS