mapkitjs resource websites cannot be found

I am trying to use mapkitjs. I have used mapkit on ios extensively, but would like to use mapkitjs, as well. When I load a simple webpage, the page generated by the dashboard when I generated a token on the dashboard, the javascript console shows that the resources are not loading because the webpages cannot be found by Safari. One page, for instance, is: https://mw-ci1-mapkitjs.geo.apple.com/admin/source-maps/5.75.101/source-maps/libs/mapkit.core.f5d12d.js.map There are several others, as well. The map does display correctly, I am able to declare a coordinate and region and have the map display the map showing that region. However, attempting to add an annotation does not work, as the variable MarkerAnnotation can not found. The error is: [Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: MarkerAnnotation I have tried changing the library from "map" to "full-map" and that does not seem to help. I do not understand why all the mapkitjs libs cannot be found by Safari. Is it because at this early stage I am just hardcoding the token in the page? Nothing indicates this is a problem.

Add a Comment

Replies

Okay, I resolved the real problem that concerned me, that the MarkerAnnotation was not found. Unlike the example on the Apple webpage (https://developer.apple.com/maps/web/) for adding annotations which declared a new annotation this way, var sfoAnnotation = new MarkerAnnotation(sfo, { color: "#f4a56d", title: "SFO", glyphText: "✈️" }); ... it was necessary for me to declare it this way, var sfoAnnotation = new mapkit.MarkerAnnotation(sfo, { color: "#f4a56d", title: "SFO", glyphText: "✈️" }); ... note the needed "mapkit." for the type to be found! Once again, Apple ...

After further use, I noticed that when I include more libraries (or using mapkit.js, not mapkit-core.js), most of the resources seemed to be loaded, apparently, so I assume that their not loading is not a problem. I only have one that never loads at this point, so there must be something that I am not taking advantage of! Not really sure, and no longer worried about it. Thanks Apple, for creating this js library, because I had used UMN's Mapserver in the past, but had no desire to maintain a machine on the web to serve maps with it. This makes a cool companion to an app.