I have written a document based application which has disabled auto-creation of new documents when the app launches without restoring a previously opened document.
Now I would also like to disable the open panel that appears on app launch.
The open panel is being launched sometimes between applicationWillFinishLaunching:
and applicationDidFinishLaunching:
in my app delegate.
The only way that I can figure out how to disable this functionality is to overwrite [NSDocumentController openDocument:]
in a subclass and then create a secondary 'helper' method that I would then connect to the File>Open menu. This seems like a very hacky solution and want to see if anyone has any better ideas.
1 Core Animator 0x0000000100042121 -[NSDocumentController openDocument:] + 49
2 AppKit 0x00007fff8772ffe6 -[NSDocumentController(NSInternal) _showOpenPanel] + 63
3 AppKit 0x00007fff87244184 -[NSApplication _doOpenUntitled] + 290
4 AppKit 0x00007fff87243c91 __58-[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:]_block_invoke + 252
5 AppKit 0x00007fff87243a59 __97-[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:]_block_invoke_3 + 140
6 AppKit 0x00007fff872435a1 -[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:] + 798
7 AppKit 0x00007fff87241cc6 -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:registeringAsReady:completionHandler:] + 331
8 AppKit 0x00007fff87241a49 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 561
9 AppKit 0x00007fff87241495 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 244