I would like to handle open events when a user double-clicks on a file that was created by my application, or drags such a file onto the dock icon.
I've therefore implemented NSApplicationDelegate
's application:openFile:
and application:openFiles:
methods, which work as expected when the application is not running.
However, if the application is already running when the open event occurs, the application becomes focused, but the above methods are never called (breakpoints inside them are not hit) and the files do not open.
I also tried implementing application:openURLs:
. This method has the same behaviour: it is not called if the application is already running when the event occurs.
Do I need to implement different functions to handle opening files when the application is already running, or is there something else I need to do/set in order for the existing functions to be called in those circumstances?