我的一个 ionic 页面上有一张谷歌地图。这张 map 显示了一个人的住所,我正在使用地理编码器在我的谷歌地图上查看这个地址。
在 Android 上这工作正常,但在 iOS 上我的 map 是空白的(白页)。
我认为问题是由于某种原因没有为 map 设置位置,因此 map 无法正确呈现。
这段代码用于地址:
geocoder.geocode({'address': $stateParams.location}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
console.log(results);
start = results[0].geometry.location;
map.setCenter(start);
var marker = maps.createMarker(map, results[0].geometry.location, redMarker);
} else {
console.log("Geocode was not successful for the following reason: " + status);
}
});
在 iOS 上结果为空 ([]),但在 Android 上它填充了正确的信息。
有人可以帮我解决这个问题吗?
最佳答案
您必须看到返回到 IOS 的错误。我猜它与跨网站脚本有关。
关于android - iOS 上的 ionic 谷歌地图地理编码不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33236262/