从本地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\'
没有找到相关结果
已邀请:
2 个回复
芦歉竭皑
和
是两个不同的方法名称。冒号是方法名称的一部分,但是您在调用ѭ7left时将其省略了。
室邢