A note that I was addicted to the fact that when I tried to add a document-based element to what I originally made as a single app, it just didn't recognize the file. In the document-based application, there is a place to set the Document Type as an item of Info.plist. In addition to declaring the UTI and Role of the file at this location, set the Cocoa class corresponding to Class when linking with the Document class. In the case of Objective-C, there is no problem if you write the class name as it is, but when configuring a module with Swift, the name of the Document class is officially written as follows.
Info.plist
$(PRODUCT_MODULE_NAME).DocumentClass
If this is not set correctly, it will not be recognized even if you pass the file by open dialog or dragging the Dock.
It only tells me that I can't open the error message, and I'm addicted to it because there's no explanation as to why it can't be opened. Actually, there is a description in Apple's sample, but there is no direct description in NSDocument, and there are many old documents around the document base, so I think that it will be overlooked if you carelessly feel like Objective-C. Or rather, I was worried about this for an hour.
Recommended Posts