NSDistributedNotificationCenter 在 OSX10.6 以前都跑的好好的,
可以在同一部電腦的兩個應用程式間傳遞訊息,
但是到了 OSX7 Lion 卻不工作啦?
也就是說,在一個程式發出 NSDistributedNotification ,另一個程式卻收不到訊息,
請教高手,這要如何解決呀?
PS: 在 OSX10.6 及 OSX10.7 下,相同的兩個程式碼都用 XCODE 4.1 編譯執行。
求救!NSDistributedNotificationCenter在 Lion 底下不能工作啦!「已解決了」
版主: bryanchang、digdog、謝孟叡
Re: 求救!NSDistributedNotificationCenter在 Lion 底下不能工作啦!
哈哈哈!
我自己找到解答了!
原來 Lion 為彌補前朝缺陷而做的補丁喔!
Distributed notification delivery
If you want a posted distributed notification to be received immediately, be sure you are passing the NSNotificationSuspensionBehaviorDeliverImmediately suspension behavior flag when registering for the notification, or using the NSNotificationDeliverImmediately flag when posting. Bugs in Mac OS X releases prior to 10.7 meant that sometimes a distributed notification would get delivered through to suspended observers, and not be properly queued, even when those flags weren't used.
我自己找到解答了!
原來 Lion 為彌補前朝缺陷而做的補丁喔!
Distributed notification delivery
If you want a posted distributed notification to be received immediately, be sure you are passing the NSNotificationSuspensionBehaviorDeliverImmediately suspension behavior flag when registering for the notification, or using the NSNotificationDeliverImmediately flag when posting. Bugs in Mac OS X releases prior to 10.7 meant that sometimes a distributed notification would get delivered through to suspended observers, and not be properly queued, even when those flags weren't used.
I love OPERA !