• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: handleGetURLEvent getting called after applicationDidFinishLaunching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: handleGetURLEvent getting called after applicationDidFinishLaunching


  • Subject: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 20 Aug 2013 12:37:47 -0700

On 2013 Aug 20, at 11:38, Bradley O'Hearne <email@hidden> wrote:

> So far, this problem seems isolated to Snow Leopard, I have not seen it on Lion or Mountain Lion. Also, the problem is intermittent [and much more] …

Brad, you probably know more about this problem than anyone in the world today.  For issues with ancient versions of the OS, the smart strategy is: Patch It and Move On.  Even if there were an Apple engineer or two that worked on this behavior three years ago, they are no doubt totally consumed with iOS 8 or whatever comes after Mac OS X 10.9.

> 1. Is there any guaranteed invocation order of these methods, or is it completely random?

Anything you can't find in the documentation is not guaranteed.  Take the easy answer.  Just assume that it is random.  This way you're covered if it changes again in Mac OS X 10.9 or beyond.

> 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.

It could be, but exactly analogous behavior occurs when an app is launched by double-clicking a document in Finder:  -[NSDocumentController openDocumentWithContentsOfURL:display:error: runs *before* -applicationDidFinishLaunching.  But when an app is launched by an AppleScript 'open' command, -applicationDidFinishLaunching runs first.

> 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

You need to change your design so it works either way.  Move any code that requires the launch URL out of -applicationDidFinishLaunching.  It probably belongs in some derivative of -handleGetURLEvent:withReplyEvent:.  If there is code that needs to be done in -applicationDidFinishLaunching before you can handle the URL, write a -startUp method and put this code in -startUp, and invoke it within both methods.  Use a BOOL isStartedUp to prevent it from running twice.  You're done!
_______________________________________________

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


  • Follow-Ups:
    • Re: handleGetURLEvent getting called after applicationDidFinishLaunching
      • From: "Bradley O'Hearne" <email@hidden>
References: 
 >handleGetURLEvent getting called after applicationDidFinishLaunching (From: "Bradley O'Hearne" <email@hidden>)

  • Prev by Date: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • Next by Date: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • Previous by thread: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • Next by thread: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • Index(es):
    • Date
    • Thread