# Native iOS FileChooser Problem

**URL:** <https://forum.juce.com/t/native-ios-filechooser-problem/45262>\
**Category:** MacOSX and iOS\
**Created:** [March 28, 2021, 9:22am UTC](https://forum.juce.com/t/native-ios-filechooser-problem/45262 "2021-03-28T09:22:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apesoft](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@apesoft](https://forum.juce.com/u/apesoft)\
**Post date:** [March 28, 2021, 9:22am UTC](https://forum.juce.com/t/native-ios-filechooser-problem/45262/1 "2021-03-28T09:22:38Z")

</div>

Hello,  
I’ve some problems to make FileChooser using the OSNativeDialogBox to works in iOS  
Browsing a file to open it  
`c->browseForFileToOpen()`  
When attempt to copy the file using  
`fileSrc.copyFileTo(soundFontDest)`  
in app documents folder or appGroup shared folder, for instance  
I got this message:

> The fileSrc couldn’t be opened because you don’t have permission to view it.

After few days I’ve discovered that the problem is related to the juce\_ios\_FileChooser.mm file, row 88

```
controller.reset ([controllerClassInstance initWithDocumentTypes: utTypeArray
                                                                      inMode: UIDocumentPickerModeOpen]);

```

changing UIDocumentPickerModeOpen in UIDocumentPickerModeImport  
it works as aspected.

Since the browseForFileToOpen is generic, maybe it is better to change definitively in UIDocumentPickerModeImport?  
Is there a reason why I cannot get to works the copying with UIDocumentPickerModeOpen?  
Thank you, cheers.

---

<div class="post-metadata">

**Author:** ![apesoft](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@apesoft](https://forum.juce.com/u/apesoft)\
**Post date:** [March 28, 2021, 9:50am UTC](https://forum.juce.com/t/native-ios-filechooser-problem/45262/2 "2021-03-28T09:50:12Z")

</div>

Also the saveMode seems to does not work properly.  
String suffix = “\*.preset”;  
String placeHolder = “MyPreset.preset”;

```
File destFile = File::getSpecialLocation(File::userDocumentsDirectory).getChildFile(placeHolder);
destFile.create();
fc.reset(new FileChooser(TRANS("Save Preset"), destFile, suffix, true, false));

```

In the juce\_ios\_FileChooser.mm file, row 55  
UIDocumentPickerMode pickerMode = currentFileOrDirectory.existsAsFile()  
? UIDocumentPickerModeExportToService  
: UIDocumentPickerModeMoveToService;

currentFileOrDirectory.existsAsFile() return NO, so I need to create a tmp file before `destFile.create();`  
It is good? What is the difference UIDocumentPickerModeExportToService vs UIDocumentPickerModeMoveToService in this context?  
Thanks.
