我正在尝试使用Mapkit js Geocode函数,但是不确定如何调用此函数。这是我的代码,我从alert(data)得到一个空值。
https://developer.apple.com/documentation/mapkitjs/mapkit/geocoder/2973884-lookup

var geocoder = new mapkit.Geocoder({
    language: "en-GB",
    getsUserLocation: true
});

geocoder.lookup("450 Serra Mall, Stanford, CA USA", getResult);

function getResult(data) {
    alert(data);
}

最佳答案

回调的第一个参数是错误。如果没有错误,则为null。

geocoder.lookup('New York', function(err, data) {
    console.log(data);
});

关于javascript - 如何调用Mapkit js Geocode方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51832348/

10-12 13:12