How do you setup and debug URL schemes with Xamarin.Mac?
I added the following to my Info.plist
:
I then built an installer package and installed the app. But if I open mytest://
in a browser or run open mytest://
command line, neither launches my app.
Additionally, is there a way to attach the debugger in Xamarin Studio after running mytest://
? On Windows I'd use Debugger.Break
and Debugger.Attach
but those methods don't seem to be implemented in Mono.
It doesn't directly address your issue, but does the answer to this question help you at all?
Specifically, it addresses using the custom execution command option on your project. You can define a custom command to execute your application in the debugger:
Open 'Project Options', got to the 'Run>Custom Commands' section, add a custom command for 'Execute'
It also mentions the Debugger.Break behaviour:
If your app is running inside the Mono Soft Debugger with Mono 2.11 or later [...], it will set a soft breakpoint for the soft debugger and work as expected
EDIT:
You can call a URL on an already running Mac app... Can you set up a handler to trap the event, set a breakpoint inside and check that your URL is calling the already-running app properly? It might give you a clue to the behaviour or a way to further debug. Something like this:
public override void FinishedLaunching(NSObject notification)
{
NSAppleEventManager appleEventManager = NSAppleEventManager.SharedAppleEventManager;
appleEventManager.SetEventHandler(this, new Selector("handleGetURLEvent:withReplyEvent:"), AEEventClass.Internet, AEEventID.GetUrl);
}
[Export("handleGetURLEvent:withReplyEvent:")]
private void HandleGetURLEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor replyEvent)
{
// Breakpoint here, debug normally and *then* call your URL
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With