Hello all, I'm looking for the same help. I've placed this code in my viewDidLoad: method
Code:
NSError *err;
buzzSoundPlayer = [[ AVAudioPlayeralloc] initWithContentsOfURL:
[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource : @"buzz" ofType: @"caf"inDirectory: @"/"]] error: &err];
buzzSoundPlayer.numberOfLoops = 3;
[buzzSoundPlayer prepareToPlay];
I've also added this as a variable in my ViewController.m file:
Code:
AVAudioPlayer *buzzSoundPlayer;
and synthesized the setters and getters.
Now, once I have hit the record button in the application, any call like this:
Code:
[self.buzzSoundPlayer play];
plays the sound fine in the simulator, but is totally silent on the device. There are no error messages, it just doesn't play. Is there any way to get this working? Any help is greatly appreciated. Thanks.