uidocumentbrowservc

Pick UIDocument automatically in UIDocumentBrowserVC

本小妞迷上赌 提交于 2020-01-15 10:24:11
问题 I am using a uidocumentbrowservc and want to pick a UIDocument programmatically. In my case it is because i want to automatically load the last used UIDocument to save the user some time on launch, as my app seldom changes documents. My naive approach is to store last used URL in UserDefaults . Then in the viewDidLoad() of my uidocumentbrowservc I call presentDocument(at: URL) . But it doesn't work. And when i call URL.checkResourceIsReachable() I get the error: Error Domain

Document Creation with UIDocumentBrowserViewController

百般思念 提交于 2019-12-10 13:41:45
问题 The documentation for documentBrowser(_:didRequestDocumentCreationWithHandler:) says, "Create a new document and save it to a temporary location. If you use a UIDocument subclass to create the document, you must close it before calling the importHandler block." So I created a file URL by taking the URL for the user's temporary directory ( FileManager.default.temporaryDirectory ) and appending a name and extension (getting a path like "file:///private/var/mobile/Containers/Data/Application

Having Trouble Getting the UIDocumentBrowserController to open docs in a Document based app

半世苍凉 提交于 2019-12-05 00:24:05
问题 I've been working on a new Document-based app, and was super glad about the new UIDocumentBrowserController...trying to roll my own solution for the document browser UI was tricky! I'm having some trouble getting the browser to open documents after they've been created. What happens now is that when I choose to create a new document in the document browser, the document is created and opened as expected, although an error message is logged. However, after the doc is closed, I cannot reopen

Having Trouble Getting the UIDocumentBrowserController to open docs in a Document based app

馋奶兔 提交于 2019-12-03 15:14:00
I've been working on a new Document-based app, and was super glad about the new UIDocumentBrowserController...trying to roll my own solution for the document browser UI was tricky! I'm having some trouble getting the browser to open documents after they've been created. What happens now is that when I choose to create a new document in the document browser, the document is created and opened as expected, although an error message is logged. However, after the doc is closed, I cannot reopen the file, either immediately or upon subsequent launches, even though the document is displayed. However,