Reputation: 639
I am trying to use the following statement to create a document:
id myDocument = [[NSDocumentController sharedDocumentController] openUntitledDocumentOfType:@"MyClass" display:YES];
Nothing is created and myDocument
is always nil
despite the fact that MyClass
is a real class in the project and inherits from NSDocument
.
What I am doing wrong?
Upvotes: 1
Views: 82
Reputation: 46030
The type
in the openUntitledDocumentOfType:display:
method is the document type name as specified in the CFBundleDocumentTypes
in your app's Info.plist
file, not the name of your document's class.
Specifically, you need to enter the value of the CFBundleTypeName
key that corresponds to the type of document you want to open. This value is labelled by default in Xcode's property list editor as the Document Type Name
:
It's also editable in the Document Types
editor in the Info tab of your project settings:
Upvotes: 1