My document-based app has a dock menu with a 'New Document' item. The dock menu is made in Interface Builder, its item's action is connected to 'First Responder's -newDocument:
The document controller is a subclass of NSDocumentController called DocumentController.
In the app delegate this code is used to prevent the opening of an untitled document upon launch (instead the document controller's open panel is shown) :
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {
[(DocumentController *)[NSDocumentController sharedDocumentController] openDocument:self];
return NO;
}
If I now launch my app, it'll show the open panel instead of an untitled document. If I then click on the dock menu's 'New Document' item, no new document opens. If I click on the standard file menu option 'New Document' in the template main menu, a new document does open.
I can't think of a reason as to why this is so, can you? How do I get the dock menu to open a new document?
EDIT : Here is a sample project which has no NSDocumentController subclass but still has the same problem.