문제

I'm trying to call this method from a music-rendering function that is run in a different thread. The method is inside InstrumentGridViewController.

- (IBAction)stopPlayback:(id)sender{
    [self stopToneUnit];
}

This is how I'm calling the method:

dispatch_async(dispatch_get_main_queue(), ^{ [InstrumentGridViewController stopPlayback: nil]; } );

But I'm getting this warning:

Class method `+stopPlayback` not found (return type defaults to `id`)

And when I try to run:

erminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[InstrumentGridViewController stopPlayback:]: unrecognized selector sent to class 0x13e50'

I'm sure the method is there so I really don't see why this is happening.

EDIT: H2CO3 said I should call the stopPlayback method on the currently running instance. Any ideas how I could do that?

도움이 되었습니까?

해결책

Because the method is implemented as an instance method and not as a class method. You must call it on an object of class InstrumentGridViewController, and not on the class itself.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top