handleGetURLEvent getting called after applicationDidFinishLaunching
handleGetURLEvent getting called after applicationDidFinishLaunching
- Subject: handleGetURLEvent getting called after applicationDidFinishLaunching
- From: "Bradley O'Hearne" <email@hidden>
- Date: Tue, 20 Aug 2013 11:38:52 -0700
Hello….
I have a Mac app that is launched via a URL handler that is installed. The launch services / configuration setup of the URL handler is fine, app launches just as expected. However, I am seeing an intermittent problem where the URL handling method:
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
is invoked after the app delegate method:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
Normally, handleGetURLEvent is invoked first, which is important, because the implementation of that method is usually needing to capture the URL used to launch it, for later processing. That is exactly my case, and when the applicationDidFinishLaunching method is invoked first, the app fails, because it doesn't have the launch URL which has information needed to run the app.
So far, this problem seems isolated to Snow Leopard, I have not seen it on Lion or Mountain Lion. Also, the problem is intermittent -- it works just fine most of the time, even on the same machine where the problem occasionally occurs. My questions:
1. Is there any guaranteed invocation order of these methods, or is it completely random? I cannot think of any scenario where you'd want to process the URL launching event *after* the callback which signifies app launch completion. That just seems wrong.
2. Assuming that the answer to 1 is that there IS an expected invocation order, then what could possibly cause this problem? This smells an awful lot like something to do with unexpected results of thread scheduling in the OS (not in the app, I'm creating no threads at all).
If anyone has any thoughts or ideas, I'd greatly appreciate it. Even if any of you have a similar use-case of an app with a URL handler that has to grab that URL before doing anything in your app, sharing your experience might help.
Thanks,
Brad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden