Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top