无法获得可可通知工作
问题描述:
Settting了观察者代码:无法获得可可通知工作
NSNotificationCenter *defaultCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
[defaultCenter addObserver:self
selector:@selector(updateLog:)
name:@"Update Log"
object:nil];
发送通知代码:
[[NSNotificationCenter defaultCenter] postNotificationName:@"Update Log" object:self];
利用该方法定义为:
-(void)updateLog: (NSNotification *) notification {
NSLog(@"Update Log"); }
文本“更新日志“在通知发送时不会出现在日志中。 感谢任何想法,为什么此代码无法正常工作。
我讨厌增加噪音,因为我在OS X上不是Cocoa的专家,但是您确定共享工作区的通知中心与默认通知中心相同吗? – warrenm 2010-09-15 01:26:55