通过URL Scheme或其他方式打开iOS 11文件应用程序

Shi*_*ama 7 iphone url-scheme ios ios11 files-app

我的应用程序现在Documents在iOS 11文件应用程序"On My iPhone"部分共享目录.

(感谢这篇文章:在iOS 11中使用Files App)

问题是如何通过URL Scheme打开此目录或至少打开文件应用程序根页面.UIDocumentPickerViewController或者UIDocumentBrowserViewController在这种情况下没有帮助.

小智 6

    guard let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first,
          let components = NSURLComponents(url: documentDirectory, resolvingAgainstBaseURL: true) else {
        return
    }
    components.scheme = "shareddocuments"
    
    if let sharedDocuments = components.url {
        UIApplication.shared.open(
            sharedDocuments,
            options: [:],
            completionHandler: nil
        )
    }
Run Code Online (Sandbox Code Playgroud)


Pao*_*olo 2

可以使用 URL 方案打开文件应用程序shareddocuments://

\n\n

我不知道\xe2\x80\x99是否有\xe2\x80\x99s打开特定目录的方法。

\n