Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't my Apps Documents folder visible?

Tags:

xcode

ios

iphone

for my iOS app i want my users to store files in the apps document folder. But it isn't visible on install. I've set both UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace to true but the folder isn't visible. I've followed these exact steps described here.

this is how it should be

image

like image 879
Sem Shimla Avatar asked Oct 30 '25 14:10

Sem Shimla


1 Answers

I tried following this tutorial, writing a document to the documents directory (see code below), ensuring that both UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace were enabled, but still I was not seeing my App's folder in the File Browser.

It worked in the simulator, but not on a device.

Turns out the fix was to restart the device.

This was running 13.3.1.

Update: Other times even after a restart it would require hitting the back "Locations" button, and then "On My iPad" to refresh the list.


func createFileInDocumentsDirectory() {
    let file = "test.txt"
    let text = "Hello world"

    let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
    let fileURL = dir.appendingPathComponent(file)
    try! text.write(to: fileURL, atomically: false, encoding: .utf8)
}
like image 132
Senseful Avatar answered Nov 02 '25 07:11

Senseful



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!