Relaunching an already launched application
-
28-05-2021 - |
Question
I have created an application for Mac OS X, and I have a desktop shortcut for it (created using ln -s
). Now I want to add a feature such that whenever this shortcut is double clicked, with the application already running, some action should be performed (like opening a Finder window at a designated path). How can this be implemented?
I tried to create an observer for NSApplication
-based notifications inside my application, but nothing constructive came of it.
Can anyone please help?
Solution
In your application's delegate, implement -applicationShouldHandleReopen:hasVisibleWindows:
and do whatever you like.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow