Can't See userDocumentsDirectory in iOS File Chooser

I’m trying to use the JUCE file chooser to see the contents of the iOS user documents directory as follows:

auto ckDocs = File::getSpecialLocation(File::userDocumentsDirectory);
Array<juce::File> results;
ckDocs.findChildFiles(results, juce::File::TypesOfFileToFind::findFilesAndDirectories , true,"*.mid");
std::cout << "files in Docments directory "<< results.size() <<"\n";

FileChooser chooser ("Open Sequence", ckDocs, "*.ckf;*.mid; *.ppf",  true);
if (chooser.browseForFileToOpen())
    File file = chooser.getResult(); //Chooser does not show the user documents folder
    if (!file.isDirectory())
        String fn = file.getFullPathName();

My app copies some files to the user documents directory during app startup. I can see they exist using the ckDocs.findChildFiles( …

However when the file chooser opens it only shows “On My iPad”, “iCloud Drive” and “Recently Opened”.

I am specifically asking it to show only the contents of the user documents directory. What is the problem?

You should be able to access contents of your app if you open app’s Info.plist as source and add the following key:


we should probably add an option for this into Projucer in iOS exporter.

Thanks! That worked.

1 Like

Great! Here I added an option to Projucer, so you don’t have to update the plist manually:

Great! I’ll update from the dev branch to get it.

I have a related question: The file browser shows midi documents in my iCloud account, and when I click on them they indicate they are downloading to my iPad, but my app reads nothing when it tries to load them. Whereas midi files from my userDocuments directory now do load correctly. Do I need to set something to enable loading documents from the user’s iCloud account?

great, didn’t even know this was possible!

Hi, when loading from cloud files you need to use the URL results, so in your above example:

if ( !fc.getURLResult().isEmpty() ) {
    StringPairArray responseHeaders;
    int statusCode = 0;

    ScopedPointer<InputStream> p_stream( fc.getURLResult().createInputStream( false, nullptr, nullptr, String(), 
        10000,&responseHeaders, &statusCode ) );