I am currently trying out this code:
NSString *path = [[NSBundle mainBundle] pathForResource:@'dream' ofType:@'m4a']; AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; theAudio.delegate = self; [theAudio play];
However, the SDK says that the ViewController does not implement the AVAudioPlayer Delegate.
Any body any ideas on how to play a WAV (or M4a) using the 2.2 SDK?
You need to add
<AVAudioPlayerDelegate>to the end of your controller’s class declaration, along these lines:This’ll probably generate some more warnings about delegate methods you need to implement – follow those and you’ll be good to go.