Question

I'm writing a very lightweight app for OSX 10.6+ which will respond to a user clicking on a URL, pass that URL to another application via TCP and then exit.

So far it has registered fine to launch when a user clicks the custom url scheme. However the event seems to get lost if the app is not already running. So the users clicks the link, the app loads, but nothing happens. Once the app is running, if the user clicks the link then it grabs the event and processes it as normal.

What do I need to do to catch that initial event that causes the app to open in the first place?

Currently I'm creating the NSAppleEventManager in the applicationDidFinishLaunching method, and this works for all events created AFTER the initial load, just not for the one that actually opened the app itself.

Any advice would be brilliant!

Thanks!

Was it helpful?

Solution

You should be creating your AppleEvent handlers in -applicationWillFinishLaunching: instead.

The idea is to have your handlers ready to go before your application begins processing AppleEvents.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top