我在两个进程之间使用 NSDistributedNotifications 作为 macOS 上的 IPC。有时我看到通知已发送但未收到,并且未执行所需的操作。
发件人代码:
[[NSDistributedNotificationCenter defaultCenter]postNotificationName:@"doSomething" object:myObject userInfo:config deliverImmediately:YES];
收货人代码:
[[NSDistributedNotificationCenter defaultCenter]addObserver:self selector:@selector(myfunc:) name:@"doSomething" object:myObject];
有没有办法调试这个?我可以运行一些命令行实用程序(如 dtrace 左右)来查看通知是否已发送到所需的进程?任何帮助都将是可观的