从本地c函数引发事件?

| 我正在开发一个在播放系统声音后对本机c函数进行回调的应用程序。我想在发生这种情况时引发一个事件,因此我认为一个订阅者可以处理它。
-(void) completionCallback(SystemSoundID mySSID, void* myself) {
   [[NSNotificationCenter defaultCenter] postNotificationName:@\"SoundFinished\" object: myself];
}
我收到
unrecognized selector sent to instance ...
在视图上,我有以下代码:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(soundStopped) name:@\"SoundFinished\" object:nil];
...
-(void) soundStopped: (NSNotification*) notification {
    NSLog(@\"Sound Stopped\");
}
我对Objective-C极为陌生,哪里出问题了? 更新确切的错误是:
    2011-04-18 19:27:37.922 AppName[5646:307] *** Terminating app due to uncaught exception \'NSInvalidArgumentException\', reason: \'-[BackgroundTestViewController soundStopped]: unrecognized selector sent to instance 0x13b4b0\'
已邀请:
-soundStopped
-soundStopped:
是两个不同的方法名称。冒号是方法名称的一部分,但是您在调用ѭ7left时将其省略了。
问题出在通知处理程序中(您注册了观察者未处理的选择器)。向我们展示如何添加观察者。从“普通C”功能发送通知没有问题。

要回复问题请先登录注册