Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a AVAudioPlayer play failure?

I'm using an AVAudioPlayer to play a mono AIFF file from my app's Documents directory.

On the simulator, [player play] returns YES and I hear the file playing. On the device the play method returns NO and nothing happens. I grabbed the file via the Organizer - it plays back fine on my Mac and seems to be well-formed. I realize the simulator can access codecs that aren't available on the iPhone, but that shouldn't matter in this case, should it?

I'm at a loss as to how to debug this. Any suggestions?

like image 883
Calhoun Avatar asked Nov 06 '22 16:11

Calhoun


1 Answers

I asked this question on Apple's forum and someone there asked if I had activated an Audio Session. I hadn't, and doing so fixed my problem.

like image 74
Calhoun Avatar answered Nov 15 '22 05:11

Calhoun