|
本帖最后由 syouk 于 2017-2-16 16:42 编辑
在IOS上面,获取当前位置的地址信息失败,返回结果没有执行,下面是代码;请帮忙看下,什么原因; 安卓平台是可以的!
var aMap = api.require('aMap');
aMap.open({
rect: {
x: 0,
y: headerH,
w: api.winWidth,
h: api.winHeight-headerH
},
showUserLocation: true,
zoomLevel: 16,
fixed: true
}, function(ret, err) {
if (ret.status) {
/*我当前所在位置*/
aMap.getLocation({
autoStop: true
},function(ret,err){
if( ret.status ) {
var thisLocation = ret;
aMap.setCenter({
coords: {
lon: thisLocation.lon,
lat: thisLocation.lat
},
animation: false
});
alert(thisLocation.lon+':'+thisLocation.lat); //提示 : 113.0093:28.11236
/*根据经纬度查找地址信息*/
aMap.getNameFromCoords({
lon: thisLocation.lon,
lat: thisLocation.lat
}, function(ret, err) {
if (ret.status) {
alert(ret.city); //没有执行
} else {
alert(JSON.stringify(err)); //没有执行
}
});
} else {
alert('获取当前位置失败');
}
});
} else {
alert(JSON.stringify(err));
}
}); |
|