Hi, I am trying to invoke this NSApplicationDelegate callback from my Mac app, but it's not getting called:
- (void)application:(NSApplication *)application openURLs:(NSArray<NSURL *> *)urls
I have registered the URL scheme in my Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.my.testapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mytestapp</string>
</array>
</dict>
</array>
Now I use a 2nd Mac app to test this out, by invoking the following code:
if let url = URL(string: "mytestapp://") {
NSWorkspace.shared.open(url)
}
This causes my first app to come to the foreground, and the "applicationDidBecomeActive:(NSNotification *)notification" method gets called, but the "application:(NSApplication *)application openURLs:(NSArray<NSURL *> *)urls" method mentioned above doesn't get invoked, which is what I want.
Any ideas about why that might be the case?