iOS Garageband and native FileChooser loadFileAsString returns empty string

I can’t figure out how file access on iOS works. When i access the document folder i’m getting following path by JUCE:

/var/mobile/Containers/Data/PluginKitPlugin/15769554-7F73-4847-ADB8-F94F51302981/Documents/PLUGIN_NAME/presets/FMR Presets Bank/Arp/ARP Bass Arpeggio FMR.pjunoxl

All works with this path. I can write and read files and my internal preset browser works also in GarageBand. loadFileAsString returns the text contained in the file.

When i pass exactly the same document folder and open the native FileChooser in GarageBand (it works in the standalone version). The file chooser returns a slightly different path after selecting the same file:

/private/var/mobile/Containers/Data/Application/C40884E9-EDF5-4F01-99C0-EBDB0325FD77/Documents/PLUGIN_NAME/presets/FMR Presets Bank/Arp/ARP Bass Arpeggio FMR.pjunoxl

loadFileAsString always returns an empty string in this case for that path, but existsAsFile returns true. The file is 1Kb, so i don’t think it’s empty. I can imagine that it has something to do with sandboxing.

Would be great if someone can give me some information how this works. What happens here?

My new question is, how can i manage presets iOS? I want to use the same folder for the standalone and the Auv3 from inside garage band.

Any input welcome.

I have found this thread about the issue:

Is this still not supported by juce directly and is it still not possible to write the preset into the shared document folder?

My original thread on the subject is still the way to do it.

  1. The AUv3 is sandboxed. It has its own /Documents folder. This is different than the standalone one.

  2. The AUv3 can see the standalone’s folder tree (per Tom’s comments in that thread) but can not write to it.

  3. The only way the AUv3 and Standalone can share write access to the same folder is to use the Security Group.

  4. The Security Group is owned by the standalone/AUv3 pair and nothing else can see it or write to it.

  5. This all has to be hand-rolled (per my instructions, with some Obj-C++ coding) as there is no facility for this in JUCE as of yet.

1 Like

I will look at it as soon as i can access my apple developer account again :grimacing:

Hi Chris, thanks for your help. I’m a iOS beginner and it’s a real pain to get this working. I get an empty string when i request the path with the obj c code and the group identifier.

File result = File();
NSFileManager* fm = [NSFileManager defaultManager];
NSURL *containerURL = [fm containerURLForSecurityApplicationGroupIdentifier:@""];
String tmp = ([containerURL.relativeString UTF8String]);
return tmp.substring(6);

What i did:

  • I added an app group in the developer portal. For AUv3 and Standalone, assigned the same app group.
  • Downloaded the profiles and added them to the device in XCode.
  • Checked the App Group feature in ProJucer.
  • Added the obj code and access it with the app group identifier.
    –> i’m getting an empty string NSURL is nil.

Is there something i miss? Do i need to define the resource path somewhere or should i receive one with a somehow auto generated name?

Did you see the RuntimePermissions class? AFAIK you need to request externalStorage permission:

RuntimePermissions::request (
    [this] (bool wasGranted)
         if (! wasGranted)
             // ...

No, i didn’t that as far as i know. After some more tries i had to check a specific app group name in the XCode capabilities. After that it worked:

I just wonder if there is a way to configure this in projucer. I checked the app group in projucer, but didn’t found a way to enter the group identifier. Can this be done or do i have to set it manually always when i save the project with projucer?

Cool, I always forget on which platform RuntimePermissions is needed. Seems to be android then. I always add it just in case, maybe one day audio becomes usable on android. And it is cancelled out on iOS, so no harm.

Don’t know about app groups, I am following, hoping to use it later myself :wink:

1 Like

Just to be sure. Is it right that the native file browser can’t access the app group shared folder?