I am developing an application for OSX and have to handle custom URL handling in my application
<a href="openApp:[email protected]">Open My profile!</a>
While Application is Running I am able to get event inside
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent{
}
But when Application not running : it did Come to AppDidFinishedLaunching and i am not able to detect whether its invoked normally or by Custom URL ,
Is there any way to detect while App Launching ?
Thanks in advance
Instead of implementing
-applicationDidFinishLaunching:
, you should implement the more modern delegate method-application:didFinishLaunchingWithOptions:
. You can then examine thelaunchOptions
dictionary and look for the keyUIApplicationLaunchOptionsURLKey
. If you find that key in the dictionary, your app was launched in response to a custom URL. The URL itself is the value that corresponds to that key in the dictionary.You can use the same method (looking for different keys, of course) to tell if your app was launched in response to a notifications, a location event, etc.