# iOS Standalone crashes with external audio interface

**URL:** https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411
**Category:** MacOSX and iOS
**Created:** [January 6, 2023, 12:56pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411 "2023-01-06T12:56:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)
#### Post date: [January 6, 2023, 12:56pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/1 "2023-01-06T12:56:36Z")

</div>

This is only happening with the standalone, AUv3 works fine in several hosts.  
If I run the standalone with an audio interface connected to the iPad, the screen goes black, and after a few seconds, the app exits. I found a few crashes in the Analytics section but there are no symbols so I have no clue how to use these.  
However, if I run the standalone without the audio interface connected and then I connect it, it works. It takes a few seconds to load, but no crashes.  
I confirmed this with a few of our products on two different iPads with two different audio interfaces.  
Any clue?

---

<div class="post-metadata">

### Author: ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)
#### Post date: [January 6, 2023, 1:57pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/2 "2023-01-06T13:57:20Z")

</div>

After checking [this thread](https://forum.juce.com/t/problems-initializing-audioappcomponent-in-ios-with-usb-audio-interface/31518), I’ve tried the same thing and it seems to be working.  
Basically forcing `availableSampleRates` to only have 48000. I’ll do more tests, but this seems like a very big issue that should not happen.

---

<div class="post-metadata">

### Author: ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)
#### Post date: [January 6, 2023, 2:28pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/3 "2023-01-06T14:28:14Z")

</div>

Ok so, I think that the way `updateAvailableSampleRates()` in juce\_ios\_Audio tests all the sample rates is the real issue rather than a specific sample rate.  
I’ve changed the sample rate logic to this:

```auto
        Array<double> sampleRatesToTest { 22050, 44100, 48000, 88200, 96000, 192000 };
        for (auto rate : sampleRatesToTest)
        {
            const double supportedRate = trySampleRate (rate);
            JUCE_IOS_AUDIO_LOG ("Trying a sample rate of " << rate << ", got " << supportedRate);
            availableSampleRates.addIfNotAlreadyThere (supportedRate);
            rate = jmax (rate, supportedRate);
        }

```

seems to be working in my case. Also, worth noting, it took several seconds (even up to 10) before crashing, now it loads really quickly.

Again, the issue happens only when there’s an audio interface connected, but I have no idea how to debug an iPad with an audio interface. I tried to use a dongle to connect 2 usb-c cables and XCode doesn’t see the iPad.

---

<div class="post-metadata">

### Author: ![phraemer](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/phraemer/32/10076_2.png) [@phraemer](https://forum.juce.com/u/phraemer)
#### Post date: [March 8, 2023, 12:39pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/4 "2023-03-08T12:39:41Z")

</div>

Yes we just ran into the same or related issue. For example I have a Focurite Scarlett 2i6 connected via USB. Starting a standalone app causes continuous clicking for 10s of seconds as the card is activated/deactivated while testing if it can handle the requested rate. If I’m not debugging then the app gets killed or crashes. I suspect killed as it’s taking too long to come up. If debugging it doesn’t crash or get killed as I think iOS knows it’s being debugged.

Even if it didn’t crash/get killed the continuous clicking is a problem.

---

<div class="post-metadata">

### Author: ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)
#### Post date: [March 8, 2023, 1:01pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/5 "2023-03-08T13:01:49Z")

</div>

Have you investigated `JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES` at all? There’s some more info in this thread:

> [@AudioDeviceSelectorComponent - UI locking up for 10 secs on iOS](https://forum.juce.com/t/audiodeviceselectorcomponent-ui-locking-up-for-10-secs-on-ios/37313/6):
>
> i just got another bug report for another audio interface and i’m gathering info, so i think anything that improves the situation would be welcome.

Essentially, there doesn’t seem to be an API for an interface to advertise its supported rates on iOS. Instead, the app has to query the rates that it wants to use. By setting `JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES`, you can limit the number of different samle rates that are tested.

The crash seems like a problem that would be good to fix, but it’s likely to be difficult to repro without hardware that causes the problem. Have you tested any other devices, and if so, do they behave in the same way?

---

<div class="post-metadata">

### Author: ![phraemer](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/phraemer/32/10076_2.png) [@phraemer](https://forum.juce.com/u/phraemer)
#### Post date: [March 8, 2023, 1:05pm UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/6 "2023-03-08T13:05:34Z")

</div>

Interesting. Thank you. Will look into it further and try out with more external hardware and report back.

---

<div class="post-metadata">

### Author: ![phraemer](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/phraemer/32/10076_2.png) [@phraemer](https://forum.juce.com/u/phraemer)
#### Post date: [March 16, 2023, 11:49am UTC](https://forum.juce.com/t/ios-standalone-crashes-with-external-audio-interface/54411/7 "2023-03-16T11:49:49Z")

</div>

OK, in addition to the Focusrite I tested with an M-Audio M-Track Solo and no clicks so I think it’s fair to say this is hardware specific.  
The Solo doesn’t support as many rates so comes up a lot faster.  
What we might have to do is limit to some common explicit rates like AUM does but we could offer the user advanced settings where they can probe for more.
