I am seeing a random crash on the AVAudioEngine startAndReturnError method call. I am not able to reproduce this but I am getting a lot of crash reports from the application on the store. My application mix audio from mulitiple files which I pretty much copy the code from the sample project UsingAVAudioEngineforPlaybackMixingandRecording. I tried to add try-catch block to the call and it does not seem to catch the exception. Any ideas or suggestion on how to debug this? It happens across device models (iPhone, iPad, iPod) and iOS (8 and 9)
Thread : Fatal Exception: com.apple.coreaudio.avfaudio
0 CoreFoundation 0x23d9468b __exceptionPreprocess
1 libobjc.A.dylib 0x35292e17 objc_exception_throw
2 CoreFoundation 0x23d94561 +[NSException raise:format:]
3 libAVFAudio.dylib 0x22652c21 AVAE_RaiseException(NSString*, ...)
4 libAVFAudio.dylib 0x22665dd5 AVAudioEngineGraph::PerformCommand(AUGraphNode&, AVAudioEngineGraph::ENodeCommand, void*, unsigned long) const
5 libAVFAudio.dylib 0x226669e3 AVAudioEngineGraph::Initialize()
6 libAVFAudio.dylib 0x226a3cc3 AVAudioEngineImpl::Initialize()
7 libAVFAudio.dylib 0x226a2bdf AVAudioEngineImpl::Start(NSError**)
8 libAVFAudio.dylib 0x226a2b53 -[AVAudioEngine startAndReturnError:]
9 Acapella 0x000bd98b __33-[MCAudioMixer initWithMetadata:]_block_invoke (MCAudioMixer.m:182)
10 Foundation 0x24b48b39 __22-[__NSObserver _doit:]_block_invoke
11 Foundation 0x24b4c80d __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
12 Foundation 0x24aae217 -[NSBlockOperation main]
13 Foundation 0x24aa04e1 -[__NSOperationInternal _start:]
14 Foundation 0x24b4eac5 __NSOQSchedule_f
15 libdispatch.dylib 0x35994d17 _dispatch_client_callout
16 libdispatch.dylib 0x359a30b1 _dispatch_main_queue_callback_4CF$VARIANT$mp
17 CoreFoundation 0x23d579ad __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
18 CoreFoundation 0x23d55ea7 __CFRunLoopRun
19 CoreFoundation 0x23ca9249 CFRunLoopRunSpecific
20 CoreFoundation 0x23ca9035 CFRunLoopRunInMode
21 GraphicsServices 0x2cd5bad1 GSEventRunModal
22 UIKit 0x27ebe8a9 UIApplicationMain
23 Acapella 0x0015fc63 main (main.m:14)
24 libdyld.dylib 0x359de873 start