I was building a Document based app for OS X using Swift in Xcode 6 Beta 4 and it worked fine. After upgrading to Xcode 6 Beta 5, however, I get the following error message every time a document window tries to open:
The DocumentType type doesn't map to any NSDocumentClass.
I edited the Document Type in the Info screen to try to match the class. I tried ${PRODUCT_MODULE_NAME}.Document
, MyApp.Document
, and simply Document
, but got the same error message every time.
Finally, I tried creating a brand new, template-based document app using Swift, and it didn't work either. When I created a new app using Objective C, there was no problem at all. So clearly it's a problem with Swift and Xcode 6 Beta 5.
Anyone have any ideas about how I can fix this? Or is this just a bug I'll have to wait out?
You were using the wrong type of bracket
${PRODUCT_MODULE_NAME}.Document
It should be:
$(PRODUCT_MODULE_NAME).Document
Do not confuse with either:
$(PRODUCT_NAME).Document
$(PRODUCT_BUNDLE_IDENTIFIER).Document
This appears to be a bug, or undocumented change in functionality. As Keenle said in his comment, the temporarily answer can be found at devforums.apple.com/message/1017433#1017433 in Post #7:
For NSDocumentClass, instead of just "ClassName" enter "ModuleName.ClassName". The ModuleName being the main name of the module (what you see at the top of the Project Navigtor and many other places).
So if your module was "MyProject" and your document was "MyDocument", try entering "MyProject.MyDocument".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With