0

I have macOS application which registers for custom scheme URL (in Info.plist) and I have a code

NSAppleEventManager.shared().setEventHandler(self, andSelector: #selector(self.handleGetURL(event:reply:)), forEventClass: UInt32(kInternetEventClass), andEventID: UInt32(kAEGetURL) )

It all works fine, when my application is launched and somebody clicks on a URL (containing this custom scheme).

However, in the case, if my app isn't started then system start is (which is good). Unfortunately, handleGetURL() isn't called.

There are two problems with it: - How can I learn whether an application was launched a usual way or was triggered by the system to handle url? - How can I get a URL which I need to handle (if an application wasn't running)

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184

1 Answers1

1

Apparently, registering on applicationDidFinishLaunching is too late. I registered on applicationWillFinishLaunching and everything worked as a charm.

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184