我正在尝试从另一个线程中运行的音乐渲染函数调用此方法。该方法位于InstrumentGridViewController
内。
- (IBAction)stopPlayback:(id)sender{
[self stopToneUnit];
}
这就是我调用方法的方法:
dispatch_async(dispatch_get_main_queue(), ^{ [InstrumentGridViewController stopPlayback: nil]; } );
但是我收到了这个警告:
Class method `+stopPlayback` not found (return type defaults to `id`)
当我尝试跑步时:
erminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[InstrumentGridViewController stopPlayback:]: unrecognized selector sent to class 0x13e50'
我确定方法已经存在,所以我真的不明白为什么会发生这种情况。
编辑:H2CO3说我应该在当前运行的实例上调用stopPlayback方法。我有什么想法可以做到这一点吗?
答案 0 :(得分:0)
因为该方法是作为实例方法实现的,而不是作为类方法实现的。您必须在InstrumentGridViewController类的对象上调用它,并且不在类本身上。