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

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)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With