My app is now sharing Documents
directory on iOS 11 Files app "On My iPhone" section.
(Thanks to this article: Working with the Files App in iOS 11)
Question is how to open this directory or at least File app root page via URL Scheme. UIDocumentPickerViewController
or UIDocumentBrowserViewController
doesn't help in this situation.
The Files app can be opened with the URL scheme shareddocuments://
.
I don’t know if there’s a way to open a specific directory however.
func openSharedFilesApp() {
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let sharedurl = documentsUrl.absoluteString.replacingOccurrences(of: "file://", with: "shareddocuments://")
print(sharedurl)
let furl:URL = URL(string: sharedurl)!
UIApplication.shared.open(furl, options: [:], completionHandler: nil)
}
This code would work.