苹果新发的 iOS 11 操作系统的一大特性是对 http 形式访问页面的限制变得非常严格(相比iOS 10 和 iOS 9)。
高德提供的JS API功能均支持http和https两种协议访问,在iOS 11操作系统上推荐使用https形式访问功能页面和接口。请先将JS API的版本升级到1.4.1版本:
然后需要满足以下两点:
1、需要使用JS API的高精度定位功能,在iOS 11上,请通过https访问定位。
2、您的个人(或企业)网站在iOS 11系统下也请您调整成https形式对终端用户提供。
如果修改之后依旧发生定位失败的情况,请参考如下:类似 Chrome 等浏览器框架目前禁止非 https 环境进行定位,请在iOS11下尝试访问如下页面:
1、可以成功定位的页面地址:/jsapi_demos/static/remogeo/
2、需要引入的 ,建议放置在本地:/jsapi_demos/static/remogeo/
3、重点需要关注的代码:
// ios环境切换到使用远程https定位if () {
//使用远程定位,见 remoGeo = new RemoGeoLocation();
//替换方法
= function() {
return (remoGeo, arguments);
};
//替换方法
= function() {
return (remoGeo, arguments);
};
}iOS 11下WebView定位超时可做如下调整:
//在添加
Privacy - LocationWhenIn Use Usage Description
日志现象:webview[6877:601452] This app has attempted to access privacy-sensitive data without a usage description. The app's must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data