If someone can add any kind of a boundary around this note about imagery on the Apple site ...
"Note
In watchOS, depending on rendering calculations, MapKit may render the map using the Standard map style rather than requested Hybrid or Imagery styles. "
That is vague to the point of meaningless.
Post
Replies
Boosts
Views
Activity
Answer: A quoted "stringtoken"!
Apple did not list the code correctly so I deleted it
Ok, no catch! So I added a catch, and now I do not have an unhandled promise rejection with a string did not match error. I just get an alert, which I put in the catch, saying "Promise Rejected." Baby steps, right? No errors in the console, the token seems to be recognized as valid, because if I send a bad one Apple says it's invalid. So why no map? Why is the promise rejected. I clearly do not know what I am doing.
I have noticed another thing, aside from the typo above (same, not some). If I change the token returned by the script, meaning send a bad token, I get the dreaded "Token is invalid" message in the javascript console, as well as the "string did not match..." message. Sending the good, valid token seems to be recognized by Apple. So what is up with the string pattern that setRequestHandler gives an Unhandled Promise Rejection?
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.
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 ...