[iPad] JUCE CoreAudio crashing on HDMI screen connect

I’m using Unity3D with Objective-C to run on iOS. JUCE is our audio provider. When we connect a screen with an HDMI cable, there is a notification that sends to an object that is no longer valid. There is a hidden call that we have no source code to find. [CoreAudioObjC screenConnect;] Is this a part of the JUCE library? I’d like to disable it’s desire to detect a screen connection or see a way to make sure that the object is not deallocated prematurely.

The error in XCode when I have Zombie Detection enabled is:

The game doesn’t crash when we disconnect a screen, or when we plug/unplug headphones, and we are using JUCE to detect and reroute the audio through the right device.

Well, there’s certainly nothing in juce that uses a class with that name: it sounds like an internal iOS thing to me.

If you can get a stack trace of the crash, it might contain some kind of clue as to what’s going on?

Thank you Jules. I wasn’t sure if this message was on the JUCE or FMOD side, and it turns out that it was on the FMOD side. If anyone comes to this post looking for more information, redirect to this post on the FMOD forum http://fmod.org/forum/viewtopic.php?f=7&t=15967&p=53782#p53782

This bug had to do with deallocating and reallocation Unity’s FMOD implementation. It registered for a screen connection listener, but in the dealloc function, it did not remove the observer. Couldn’t access the source, but I swizzled addObserver to block the observer from being added.

The one part that could be Juce related is that FMOD is deallocated and reallocated. I don’t know where that happens, but I feel that JUCE might be stopping and restarting all of Core Audio which inadvertently performs this closing.

Check my post on Stack Overflow if this happens to you. http://stackoverflow.com/questions/17710384/objective-c-remove-all-oberservers-for-a-certain-notification