ios15使用高德地圖定位失敗問題


高德地圖開放平台:https://lbs.amap.com/faq/js-api/map-js-api/position-related/46320

訪問https://a.amap.com/jsapi_demos/static/remogeo/remo.html

查看源碼如下:

            // ios環境切換到使用遠程https定位
            if (AMap.UA.ios && document.location.protocol !== 'https:') {

                //使用遠程定位,見 remogeo.js
                var remoGeo = new RemoGeoLocation();

                //替換方法
                navigator.geolocation.getCurrentPosition = function() {
                    return remoGeo.getCurrentPosition.apply(remoGeo, arguments);
                };

                //替換方法
                navigator.geolocation.watchPosition = function() {
                    return remoGeo.watchPosition.apply(remoGeo, arguments);
                };
            }

實際使用中要加上document.location.protocol !== 'https:'這個條件,但官網給出的解決方案中沒有這句

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM