iOS app crashing only on certain devices (from App Store)

I just released an iOS app built with JUCE and React Native, appeared on the App Store today :champagne:

However, there’s been a few reports of it crashing on start up, only on certain devices. I can’t reproduce it on my test devices.

The strange thing is this app has been working on various test devices, only now its being downloaded from the App Store has this bug appeared.

I managed to symbolicate one of the crash logs and here is what I got:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000

...

|0   MyApp                      |0x0000000100bb01c4 -[JuceUIView initWithOwner:withFrame:] + 0|
|---|---|
|1   MyApp                      |0x0000000100b62ed4 juce::Component::createNewPeer+ 3010260 (int, void*) + 340|
|2   MyApp                      |0x0000000100b628d4 juce::Component::addToDesktop+ 3008724 (int, void*) + 440|
|3   MyApp                      |0x0000000100b880a0 juce::TopLevelWindow::TopLevelWindow+ 3162272 (juce::String const&, bool) + 112|
|4   MyApp                      |0x0000000100bb536c juce::DocumentWindow::DocumentWindow+ 3347308 (juce::String const&, juce::Colour, int, bool) + 56|
|5   MyApp                      |0x0000000100ae7634 MyApp::initialise+ 2504244 (juce::String const&) + 788|
|6   MyApp                      |0x0000000100b19724 juce::JUCEApplicationBase::initialiseApp+ 2709284 () + 864|
|7   MyApp                      |0x0000000100bb6140 -[JuceAppStartupDelegate applicationDidFinishLaunching:] + 72|

The thing is it shouldn’t be calling addToDesktop on startup, as this app is pulling a JUCE Component UIView into a React Native component.
Edit: I’ve just realised that addToDesktop is the fourth parameter of the DocumentWindow constructor and defaults to true. I’m going to try it with false and see if that helps.

Also interesting is that almost identical code is part of an app that’s been on the App Store for a couple of months already. The difference is, with that app the JUCE generated view is not loaded on startup; with this one it is.

My MainWindow class looks like this (reduced to relevant parts):

MainWindow::MainWindow (String name)  : DocumentWindow (name,
                                                        Colours::lightgrey,
                                                        DocumentWindow::allButtons)
{

    //... 

    /** React Native Navigation bootstrap **/
    
    // Get reference to current JuceApplication instance
    NSObject<UIApplicationDelegate> *appDelegate = [[UIApplication sharedApplication] delegate];
    
    appDelegate.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    appDelegate.window.backgroundColor = [UIColor blackColor];
    [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation];
    

Well this turned out to be a total red herring, the issue was actually due to some borrowed synth code trying to write to 2 channels on mono devices…