z***@hotmail.com
z***@hotmail.com
  • 发布:2021-09-24 11:46
  • 更新:2021-10-08 09:54
  • 阅读:670

【报Bug】ios15 引用高德js sdk创建地图白屏。

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 3.2.6

手机系统: iOS

手机系统版本号: IOS 14

手机厂商: 苹果

手机机型: ipone8plus+ios15

打包方式: 云端

示例代码:
<!doctype html>  
<html>  
<head>  
    <meta charset="utf-8">  
    <meta http-equiv="X-UA-Compatible" content="IE=edge">  
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">  
    <title>浏览器精确定位</title>  
      <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />  
    <style>  
        html,body,#container{  
            height:100%;  
        }  
        .info{  
            width:26rem;  
        }  
    </style>  
<body>  
<div id='container'></div>  
<div class="info">  
    <h4 id='status'></h4><hr>  
    <p id='result'></p><hr>  
    <p >由于众多浏览器已不再支持非安全域的定位请求,为保位成功率和精度,请升级您的站点到HTTPS。</p>  
</div>  
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=您申请的key值"></script>  
<script type="text/javascript">  
    var map = new AMap.Map('container', {  
        resizeEnable: true  
    });  
    AMap.plugin('AMap.Geolocation', function() {  
        var geolocation = new AMap.Geolocation({  
            enableHighAccuracy: true,//是否使用高精度定位,默认:true  
            timeout: 10000,          //超过10秒后停止定位,默认:5s  
            buttonPosition:'RB',    //定位按钮的停靠位置  
            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)  
            zoomToAccuracy: true,   //定位成功后是否自动调整地图视野到定位点  

        });  
        map.addControl(geolocation);  
        geolocation.getCurrentPosition(function(status,result){  
            if(status=='complete'){  
                onComplete(result)  
            }else{  
                onError(result)  
            }  
        });  
    });  
    //解析定位结果  
    function onComplete(data) {  
        document.getElementById('status').innerHTML='定位成功'  
        var str = [];  
        str.push('定位结果:' + data.position);  
        str.push('定位类别:' + data.location_type);  
        if(data.accuracy){  
             str.push('精度:' + data.accuracy + ' 米');  
        }//如为IP精确定位结果则没有精度信息  
        str.push('是否经过偏移:' + (data.isConverted ? '是' : '否'));  
        document.getElementById('result').innerHTML = str.join('<br>');  
    }  
    //解析定位错误信息  
    function onError(data) {  
        document.getElementById('status').innerHTML='定位失败'  
        document.getElementById('result').innerHTML = '失败原因排查信息:'+data.message;  
    }  
</script>  
</body>  
</html>

操作步骤:

使用上面的代码示例在新打包的5+app打开会白屏

预期结果:

ios15正常打开

实际结果:

ios15打开白屏

bug描述:

ios15的苹果手机使用高德官方的例子在5+app打开会白屏,定位是正常的。
以前在旧版hbuilder打包的在ios15可以正常显示。
高德地图demo
创建地图的时候页面卡死,然后白屏。

bug视频见附件

2021-09-24 11:46 负责人:无 分享
已邀请:
5***@qq.com

5***@qq.com

我也遇到了这个问题

  • z***@hotmail.com (作者)

    在升级ios15之前已经安装好的APP,升级ios15之后就会出现这种情况。卸载重装一下就正常了,不知道啥情况。

    2021-10-25 19:50

该问题目前已经被锁定, 无法添加新回复