I am working on a widget for my existing Mac app. The problem I am running into is that when I add a Link
from the widget to the main app, the method - (void) application: (NSApplication *)application openURLs:(NSArray<NSURL *> *)urls
isn't called at all, so I'm not able to direct the app on how to best handle the widget tap.
I'm just adding a simple Link
like this:
Link(destination: URL(string: "widgetAddToDoButtonLink")!) {
Image(systemName: "plus.circle").imageScale(.medium)
}
It does foreground the main app when the Link
is tapped, but doesn't call the openURLs delegate method. Now I've tried the same thing with a new app project and widget, and it works fine. But not with my existing Mac app project, which has a deployment target of 10.15 (changing the deployment target to 12.0 didn't work).
Is there something about an old project that might be causing the openURLS
method to not be called? It works otherwise, when the "URL Type" is defined in the Info.plist (though I don't believe you need to do that to handle Widgets). In either case, adding the "widgetAddToDoButtonLink" to a new URL Schemes in the Info.plist file doesn't help either.