I have the following code and the sound_file is found. Also I get no errors. The audio file is added to the bundle. But I get no audio out on the iOS simulator.
- (void)playNotificationSound
{
NSString *sound_file;
AVAudioPlayer * audioPlayer;
sound_file = [[NSBundle mainBundle] pathForResource:@"onebell" ofType:@"caf"];
if (sound_file){
NSURL *url = [[NSURL alloc] initFileURLWithPath:sound_file];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
//audioPlayer.delegate = self;
audioPlayer.volume = 1.0f;
[audioPlayer prepareToPlay];
[audioPlayer play];
}
}