2

I want to show most root folder with UIDocumentPickerViewController on presentation.

UIDocumentPickerViewController has directoryURL feature. But I can't access the URL i want to access. Example usage documentPickerController.directoryURL = url

This is where I want it to start from

1

1- Tried documentPickerController.directoryURL = url but couldn't find the url i want to access.

2- Also this one didn't work for me.

func getDocumentsDirectory() -> URL { // returns your application folder
    let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
    let documentsDirectory = paths[0]
    return documentsDirectory
}

let path = getDocumentsDirectory().absoluteString.replacingOccurrences(of: "file://", with: "shareddocuments://")
let url = URL(string: path)!

UIApplication.shared.open(url)

vimuth
  • 5,064
  • 33
  • 79
  • 116
joemiddletone
  • 31
  • 1
  • 2
  • You can get an idea on how to do that from the oficial documentation: https://developer.apple.com/documentation/uikit/view_controllers/providing_access_to_directories – Razvan S. Feb 26 '23 at 18:59
  • #Razvan, your comment is not helping at all, as it does not answer the question and the Apple URL you indicate unfortunately don't provide any pointer on how to access the root folder. I tried to use the specific directories available from iOS 16 (such as .userDirectory, .homeDirectory), but they are not displaying the root folder. – Daniel Mavrakis Aug 28 '23 at 11:53

0 Answers0