FileChooser can't select folder with saveMode on iOS and shows "Move" dialog

Updated title: See my reply below about selecting a folder (directory)

When launching the FileChooser on iOS I’m getting a Move dialog instead of Save

        juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::canSelectFiles |

Is this actually expected?

iOS 14
Xcode 14.0.1
JUCE head of develop branch


I think this is probably expected. On iOS your app runs inside the app sandbox and you can’t directly write to the file system. You can however, write a file to your apps container and then move it via the operating system dialogue. This is the way I’ve recently implemented it in iPlug2 anyway.

How files are actually handled behind the scenes is hidden from the user though.
If the user wants to save a file to their device or iCloud or whatever then it will be surprising and odd for the dialog to say “Move” regardless of what we do behind the scenes.
The enum flag is “saveMode” too.

Pretty sure now this isn’t the correct behaviour, but not 100%. JUCE folk may have reasons that aren’t obvious to me of course.

I stepped into the JUCE code and at this point changed pickerMode to UIDocumentPickerModeExportToService which gives me the dialog I expect

A bigger problem this seems to cause is it is impossible to select a directory
Although this should be allowed

To help others that might have the same problem: I’ve learned a bit more now about the FileChooser class and while I would still like to be able to choose a folder on iOS because I want to write multiple files to that location I can work around this by setting the initialFileOrDirectory in the constructor of FileChooser to an existing file in the sandbox and bring it up once for each file I want to save to a user location. In this case the dialog does show Save. It shows Move when the initialFileOrDirectory is a directory or non existant.

Sorry for the delayed response. We’ve now added support for directory selection to the native FileChooser on iOS:


Thank you!