I am trying to load an auxiliary window from an AppKit bundle that loads a NSViewController from a storyboard. This NSViewController displays a MKMapView.
I want to avoid supporting multiple windows from my Catalyst app so I do not want to load this window via a SceneDelegate, and that is why I have chosen to go the AppKit bundle route.
If I load a similar view controller which contains a single label, then all works as expected.
However, if I try to load a view controller with the MKMapView, I get the following error after crashing:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKMapView nsli_piercingToken]: unrecognized selector sent to instance 0x15410f600'
DropBox link to sample app with buttons on a view to select either the "Map View" (crashing) or the "Label View" (working):
https://www.dropbox.com/scl/fi/q9daurhzqvil9o2ry6k1t/CatalystMap.zip?rlkey=yjbqfn6uxfrfh1jgsdavagta7&dl=0
Are you able to reproduce the exception in any form without the bridge to AppKit? You need to reconsider that approach — such bridging is unsupported and stated as such by the documentation:
Mac apps built with Mac Catalyst can only use AppKit APIs marked as available in Mac Catalyst, such as NSToolbar and NSTouchBar. Mac Catalyst doesn’t support accessing unavailable AppKit APIs.