Hi there,
I'm trying to migrate my app to using the UIDocumentViewController so I can use the new launch experience. My app exports a custom file type and uses UIDocument + UIDocumentBrowserViewController.
I tried creating a UIDocumentViewController and making it the root view of my app but it doesn't recognise my custom document type.
class Document_VC: UIDocumentViewController {
var storyCardsDocument: PlotCardDocument? {
self.document as? PlotCardDocument
}
override func viewDidLoad() {
super.viewDidLoad()
configureViewForCurrentDocument()
}
override func documentDidOpen() {
configureViewForCurrentDocument()
}
func configureViewForCurrentDocument() {
guard let document = storyCardsDocument,
!document.documentState.contains(.closed)
&& isViewLoaded else { return }
print("Document opened: \(document.fileURL)")
}
}
The app opens but when I navigate to a document made in a previous version of the app it is greyed out. I also don't see a 'New' button in the launcher view.
To try and see what I was doing wrong, I tested the markdown app sample code. When I make the UIDocumentViewController the root and try to open or create a new markdown document I get the following error:
no document class found. Define the correct UIDocument subclass with the key UIDocumentClass in the info.plist's CFBundleDocumentTypes dictionary.
1
0
493