I am using the following code to play a audio in iOS using **AVAudioPlayer** class.
NSString *audioPath = [[NSBundle mainBundle] pathForResource:@"myAudio" ofType:@"mp3"];
NSURL *audioURL = [[NSURL alloc] initFileURLWithPath:audioPath];
NSError *error;
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:&error];
audioPlayer.delegate = self;
[audioPlayer prepareToPlay];
[audioPlayer play];
This is working fine in simulator. But, i am not getting the sound output when i run it on the device. The delegate methods ofAVAudioPlayerDelegate are also being called but there is no volume output. Where am i going wrong here…. Another important aspect i’v noticed here is that, i am getting a large message in my GDB while playing the audio file on simulator. But the same thing is not happening on device… Please refer the screenshot below for GDB messages while running on the simulator.

I was so so stupid…. My volume button was turned off. That was the reason.
Really sorry for wasting your time guys… My sincere apologies.