在ios中原生的h5方法navigator.geolocation.getCurrentPosition无法获取定位, 高德地图提供了一套解决办法 直接上代码
<scripttype
="text/javascript"src
="http://a.amap.com/jsapi_demos/static/remogeo/remogeo.js"></script
>
if(navigator
.platform
==='iPhone'){
let remoGeo
= new RemoGeoLocation();
navigator
.geolocation
.getCurrentPosition = function () {
return remoGeo
.getCurrentPosition
.apply(remoGeo
, arguments
);
};
navigator
.geolocation
.watchPosition = function () {
return remoGeo
.watchPosition
.apply(remoGeo
, arguments
);
};
}
转载请注明原文地址: https://lol.8miu.com/read-17603.html