Open Maps app from Safari extension

With a Safari extension I add a link to certain websites to open the Maps app with coordinates found on the website. In the content script I detect clicks on my added link and forward the message to the background script with browser.runtime.sendMessage({ coordinates: "some coordinates I found on the website" }).

The background script receives this message in its listener function and forwards the message to the extension handler like so

browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
   browser.runtime.sendNativeMessage( { message: request.coordinates }, function(response) {
 
});
}

The extension handler receives the message in its func beginRequest(with context: NSExtensionContext) function as expected.

In this function I convert the coordinates I receive to a valid CLLocationCoordinate2D object.

However, if I want to use the following code inside the beginRequest function to open the Maps app, it does not work on iOS. The same code works fine with a macOS Safari extension.

MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: 50.1234, longitude: 8.1234))).openInMaps()

Replies

I also created a Feedback: FB9971630