Document Creation with UIDocumentBrowserViewController
问题 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