So I’m trying to play a .wave file in iOS5, and I’m getting a warning, which is leading to SIGABRTs and generally not-working code.
NSURL *soundUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Resources/Sounds/01_main_menu_list.wav", [[NSBundle mainBundle] resourcePath]]];
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];
[_audioPlayer setDelegate:self];
[_audioPlayer play];
This is giving me an error “Sending “ViewController *const __strong” to parameter of incompatible type ‘id ‘.
I have literally no idea why, I’ve followed a half-dozen examples and am coming up empty. I’d love a pointer in the right direction.
Turned out it was an issue with ARC releasing, I fixed it by adding a @property and @synthesize pair for the AVAudioPlayer in question, and declaring it as strong. It got rid of all of these errors, and played the file with no problems.