|
[BUG]
bMap的getLocation获取不了经纬度
[复制链接]
这是代码
var bmap = api.require('bMap');
var type = api.systemType;
if(type == 'ios'){
bmap.initMapSDK(function(ret,err) {
if (ret.status) {
//alert('地图初始化成功,可以从百度地图服务器检索信息了!');
}else{
//jAlert(JSON.stringify(err));
}
});
}
/*if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition,showError);
}else{
alert("浏览器不支持地理定位。");
} */
bmap.getLocation({
accuracy: '1km',
filter: 1,
autoStop: true
}, function(ret, err) {
jAlert(JSON.stringify(ret));
if (ret.status) {
bmap.getNameFromCoords({
lon: ret.lon,
lat: ret.lat
}, function(_ret, _err) {
if (_ret.status) {
jAlert(JSON.stringify(_ret));
}else{
jAlert(JSON.stringify(_err))
}
});
} else {
jAlert(JSON.stringify(err));
}
});
|
|