I am working on a document-based application. If I execute this app from the Finder it runs like expected: First the NSApplicationDelegate
applicationDidFinishLaunching
method is executed. Then the NSPersistentDocument
initialization is done. After that the defined NSDocument
makeWindowControllers
method is executed, which creates the window controllers from the WindowNibName
's.
In case of using the Finder everything works fine and the app launches like expected. But if I will execute the document-based application from another application using LSLaunchFSRefSpec
from the Launch Service Reference, the app is just shown inside the Dock. No window appears. No NSPersistentDocument
will be initialized and no makeWindowControllers
method will be executed. Only the applicationDidFinishLaunching
method is called.
At the moment the initialization and the creation of the window controllers could just be done if I activate the app from dock by one mouse click. I also tested different launch flags for the LSLaunchFSRefSpec
, without any success.
Is it possible to activate the app and create their windows automatically? Or maybe I can simulate a mouse click on the dock icon?