문제

I am developing an application for OSX and have to handle custom URL handling in my application

<a href="openApp:abc@xyz.com">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 the launchOptions dictionary and look for the key UIApplicationLaunchOptionsURLKey. 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top