Xamarin.Mac handle incoming URLs

102 Views Asked by At

I have added url in my Info.plist and trying to handle incoming url like described in this article.

I'm trying to add this code

        public override void WillFinishLaunching(NSNotification notification)
        {
            NSAppleEventManager.SharedAppleEventManager.SetEventHandler(this, new ObjCRuntime.Selector("handleGetURLEvent:withReplyEvent:"), AEEventClass.Internet, AEEventID.GetUrl);
        }    

        [Export("handleGetURLEvent:withReplyEvent:")]
        private void HandleGetURLEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor replyEvent)
        {
            Logger.Info("Calling url on running app");
        }

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.

0

There are 0 best solutions below