We've got a bunch of crashes from our users in AVFAudio HandleRouteChange method, the whole stack trace doesn't have our code at all. Our code is 100% written in Swift, so I believe that there should be no dangling pointers in the app.
Our setup is that we use AVPlayer to play an audio file from memory, and we use KVO to observe "status" on AVPlayer, and AVPlayerItem objects, and we remove observers in deinit
This crash happens on the background thread, and I have no idea what AVFAudio is. We don't listen to any audio route change other than just observing
AVAudioSessionRouteChangeNotification on an NSNotificationCenter.
Here's the stack trace.
Thread 6 CRASHED [EXC_BAD_ACCESS / KERN_INVALID_ADDRESS @ 0x5c69beb8]
0x00000001861b2f70 (libobjc.A.dylib + 0x0001af70 ) objc_msgSend
0x00000001a12ecfe0 (AVFAudio + 0x0007efe0 ) (anonymous namespace)::HandleRouteChange(unsigned int, NSDictionary*)
0x00000001a12ec48c (AVFAudio + 0x0007e48c ) AVAudioSessionPropertyListener(void*, unsigned int, unsigned int, void const*)
0x000000018a676768 (AudioToolbox + 0x00123768 ) AudioSessionPropertyListeners::CallPropertyListenersImp(AudioSessionPropertyListeners const&, unsigned int, unsigned int, void const*)
0x000000018a74c828 (AudioToolbox + 0x001f9828 ) AudioSessionPropertyListeners::CallPropertyListeners(unsigned int, unsigned int, void const*)
0x000000018a7846e0 (AudioToolbox + 0x002316e0 ) HandleCFPropertyListChange(unsigned int, unsigned int, unsigned long, unsigned char*, unsigned int)
0x000000018a7890e8 (AudioToolbox + 0x002360e8 ) HandleAudioSessionCFTypePropertyChangedMessage(unsigned int, unsigned int, void*, unsigned int)
0x000000018a788940 (AudioToolbox + 0x00235940 ) ProcessDeferredMessage(unsigned int, __CFData const*, unsigned int, unsigned int)
0x000000018a787b0c (AudioToolbox + 0x00234b0c ) ASCallbackReceiver_AudioSessionPingMessage
0x000000018a66a348 (AudioToolbox + 0x00117348 ) _XAudioSessionPingMessage
0x000000018a8e1ba0 (AudioToolbox + 0x0038eba0 ) mshMIGPerform
0x0000000187717214 (CoreFoundation + 0x000de214 ) __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
0x00000001877169c8 (CoreFoundation + 0x000dd9c8 ) __CFRunLoopDoSource1
0x00000001877144ac (CoreFoundation + 0x000db4ac ) __CFRunLoopRun
0x00000001876422b4 (CoreFoundation + 0x000092b4 ) CFRunLoopRunSpecific
0x00000001a12e3d20 (AVFAudio + 0x00075d20 ) GenericRunLoopThread::Entry(void*)
0x00000001a1309d98 (AVFAudio + 0x0009bd98 ) CAPThread::Entry(CAPThread*)
0x00000001867fd84c (libsystem_pthread.dylib + 0x0000384c ) _pthread_body
0x00000001867fd75c (libsystem_pthread.dylib + 0x0000375c ) _pthread_start
0x00000001867fad90 (libsystem_pthread.dylib + 0x00000d90 ) thread_start
Any ideas how this crash could happen?
Thanks!