# Juce 7 cannot create filebrowser in AUV3 on iOS

**URL:** <https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571>\
**Category:** Audio Plugins\
**Created:** [August 11, 2022, 5:15pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571 "2022-08-11T17:15:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [August 11, 2022, 5:15pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/1 "2022-08-11T17:15:18Z")

</div>

Hi, trying to launch a filebrowser seems to launch the browser (i.e. ui disabled) but there’s no actual browser visible. Just pulled 6.1.6 and the code works fine.

thx

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [August 13, 2022, 7:30am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/2 "2022-08-13T07:30:34Z")

</div>

Hi,  
I’m afraid I’m also being able to reproduce this. same code worked for me and seems broken with latest develop.

This is how my FileChooser is constructed.

```auto
fileChooser ("Import Preset", juce::File::getSpecialLocation (juce::File::userDocumentsDirectory), "*" + juce::String (kPresetExtension), Utils::usePlatformDialog()
#if JUCE_IOS
,
false,
getTopLevelComponent() // AUv3 Sandbox requirement
#endif
)

```

As leehu, also for me the UI ‘freeze’ on GarageBand.

Exact same code works in Standalone and also worked with JUCE 6.0.x builds.

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [August 13, 2022, 6:12pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/3 "2022-08-13T18:12:33Z")

</div>

I’ve bisected this,  
That’s the faulty commit -

> <https://github.com/juce-framework/JUCE/commit/3dd812052e0e472e9e60bf0631ab4ee155697160>
>
> This restores the functionality of JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_…CALLS.
> Using this preprocessor flag may avoid Core Graphics rendering much larger regions than
> necessary, but the small regions that are rendered will likely be rendered slower.
> Whether using this flag improves or degrades the performance of your rendering overall
> will be specific to each application.
> 
> Previously enabling JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS was ineffective
> from versions of macOS around 10.13, but enabling it didn't have any negative impact on
> performance. Now enabling JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS may result
> in slower rendering.

Note: Standalone still works, only AUv3 is broken.

Additional Observations:

- I’ve also tried with OpenGL renderer (though I didn’t sanity check myself) and had the same behavior

- Even without `JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS` this behaviour is reproduced. So it’s not the `CAMetalLayer` specifically?

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [August 14, 2022, 4:36am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/4 "2022-08-14T04:36:33Z")

</div>

I’ve found it,  
If anyone else can confirm.

On `juce_ios_UIVIewComponentPeer.mm`

change this (private decl to public).

```auto
class UIViewComponentPeer : public ComponentPeer,
                             private UIViewPeerControllerReceiver

```

to this

```auto
class UIViewComponentPeer : public ComponentPeer,
                             public UIViewPeerControllerReceiver

```

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [August 16, 2022, 5:55am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/5 "2022-08-16T05:55:44Z")

</div>

I got the same issue, even after I revert back to juce 6.0.4, my iPad is on the latest iOS 15.6, hope this can be fixed soon.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [August 16, 2022, 9:30am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/6 "2022-08-16T09:30:00Z")

</div>

I’ll try check this out today

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [August 18, 2022, 6:10am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/8 "2022-08-18T06:10:35Z")

</div>

Although the file browser dialog on iOS standalone works, but after I selected a supported audio file, it won’t get loaded, no sound on iOS, but all of my functions work under Mac and PC, I already used URL to use a file on iOS, it’s really weird.

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [August 18, 2022, 6:12am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/9 "2022-08-18T06:12:17Z")

</div>

Btw this is my code incase I did it wrong, I use browseForFileToOpen() to open the file chooser dialog window, it can open dialog in Mac/PC/iOS standalone, but will freeze in iOS AUv3.

```auto
std::unique_ptr<juce::FileChooser> chooser;
chooser = std::make_unique<juce::FileChooser> (
        "Choose a file",
        juce::File(),
        audioProcessor.getFormatManager().getWildcardForAllFormats(), true, false,
#if JUCE_IOS
        this
#else
        getTopLevelComponent()
#endif
        );

if (chooser->browseForFileToOpen())
{
auto fileURL = chooser->getURLResult();
audioProcessor.loadFile(fileURL);
}

```

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [August 18, 2022, 6:40am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/10 "2022-08-18T06:40:20Z")

</div>

> [@playpm](#):
>
> `audioProcessor.getFormatManager().getWildcardForAllFormats()`

This line is suspicious. Try other wild cards. iOS is very picky.

Yet would be nice if JUCE team could push the fix for post metal commit changes

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [August 18, 2022, 6:44am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/11 "2022-08-18T06:44:53Z")

</div>

Ok, this is trying to get all the supported audio file type, this line works in iOS standalone pretty well, will grey out those not supported files.

I really don’t know another way to do this, any suggestions?

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [August 18, 2022, 7:42am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/12 "2022-08-18T07:42:48Z")

</div>

@ttg works - nice find!

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [August 18, 2022, 3:40pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/13 "2022-08-18T15:40:51Z")

</div>

I tried this method, changing UIViewPeerControllerReceiver from private to public, then file browser under iOS AUv3 is ok, but iOS standalone freezes this time 🤣

Update: both standalone and AUv3 will work fine, if UIViewPeerControllerReceiver is public.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [August 18, 2022, 7:51pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/14 "2022-08-18T19:51:08Z")

</div>

@reuk hi - can we get some team exposure to this please. thx

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [August 25, 2022, 7:11am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/15 "2022-08-25T07:11:16Z")

</div>

@reuk, @t0m - can someone please take a look at this please. thx

---

<div class="post-metadata">

**Author:** ![instrumentMakers](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@instrumentMakers](https://forum.juce.com/u/instrumentMakers)\
**Post date:** [August 25, 2022, 9:25am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/16 "2022-08-25T09:25:19Z")

</div>

+1

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [August 30, 2022, 11:16am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/17 "2022-08-30T11:16:33Z")

</div>

Thank you for reporting.

> <https://github.com/juce-framework/JUCE/commit/44183763359d680c5409bbaaba7bfa8923eb7896>

---

<div class="post-metadata">

**Author:** ![lunelasuis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lunelasuis/32/6674_2.png) [@lunelasuis](https://forum.juce.com/u/lunelasuis)\
**Post date:** [September 20, 2022, 5:05pm UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/18 "2022-09-20T17:05:44Z")

</div>

There is one more issue with `FileChooser::Native` in AUv3. The plugin crashes if the editor is closed while FileChooser is active. Destructor is called from `ModalComponentManager::handleAsyncUpdate`, but the object is freed already. Anyone can recreate it?

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [October 25, 2022, 3:17am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/19 "2022-10-25T03:17:02Z")

</div>

Oh god, this is exactly what I’m experiencing now, did you find the solution?

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [October 25, 2022, 3:18am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/20 "2022-10-25T03:18:02Z")

</div>

> [@lunelasuis](#):
>
> There is one more issue with `FileChooser::Native` in AUv3. The plugin crashes if the editor is closed while FileChooser is active. Destructor is called from `ModalComponentManager::handleAsyncUpdate`, but the object is freed already. Anyone can recreate it?

Hi, we both found this issue, any suggestion for dealing with this?

---

<div class="post-metadata">

**Author:** ![lunelasuis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lunelasuis/32/6674_2.png) [@lunelasuis](https://forum.juce.com/u/lunelasuis)\
**Post date:** [October 25, 2022, 7:56am UTC](https://forum.juce.com/t/juce-7-cannot-create-filebrowser-in-auv3-on-ios/52571/21 "2022-10-25T07:56:04Z")

</div>

Hi. Not really, it just sits there and I dont have enough time/experience to hack native iOS wrappers. Besides the fact that we still use workarounds to make the chooser popover work in AUv3.
