Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DocumentType does not map in Xcode 6 Beta 5 using Swift

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?

like image 771
Robert R Avatar asked Aug 06 '14 17:08

Robert R


2 Answers

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

enter image description here

like image 175
jiminybob99 Avatar answered Nov 07 '22 20:11

jiminybob99


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".

like image 34
Randy Jay Yarger Avatar answered Nov 07 '22 20:11

Randy Jay Yarger