Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test flight app crashes with libAVFAudio.dylib: AVAE_RaiseException(NSString*, ...) + 60

I uploaded an archive on app store and am getting crash when I 'm trying to play an intro sound. I'm using AVAudioEngine to play the sound. When I compile and run code through Xcode everything works fine. When I upload on TestFlight and try to run my app as an internal tester my app crashes. The crash report is:

enter image description here

If I use AVAudioPlayer to play that sound it's ok. I can't understand what is the problem with AVAudioEngine. Any advices?

like image 775
Thomas Avatar asked Oct 31 '15 07:10

Thomas


1 Answers

I faced the same exception only in the release build of my app and specific to iPhone7. The exception seems to occur at a changing point of audio session category. In my case, changing from

AVAudioSessionCategorySoloAmbient

to

AVAudioSessionCategoryPlayAndRecord, with:  AVAudioSessionCategoryOptions.defaultToSpeaker

I found a workaround which works at least just for me.

The following article https://forums.developer.apple.com/thread/65656 tells that this kind of exception occurs at initialization of multiple input audio unit.

In order to prevent initialization of multiple input audio unit, I added the following codes before the change of audio session category

AudioOutputUnitStop((engine.inputNode?.audioUnit)!)
AudioUnitUninitialize((engine.inputNode?.audioUnit)!)

engine is the instance of AVAudioEngine.

I hope it will help you guys!

like image 122
Takatomo Avatar answered Oct 10 '22 09:10

Takatomo