乔珂粒i
乔珂粒i
  • 发布:2022-11-26 20:02
  • 更新:2022-11-28 23:52
  • 阅读:2617

【报Bug】uni.getLocation 直接返回errMsg 'getLocation:fail network error'

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX版本号: 3.6.5

操作步骤:

uni.getLocation({
type: 'gcj02',
geocode: true,
altitude:true,
isHighAccuracy:true,
success: function(res) {
console.log(res,111111111111111)
that.longitudeData = res.longitude;
that.latitudeData = res.latitude;

                    that.locationObj.city = res.address?res.address.city:"";  
                    that.locationObj.district = res.address?res.address.district:"";  
                    that.locationObj.street = res.address?res.address.street:"";  
                    that.locationObj.streetNum = res.address?res.address.streetNum:"";  
                    that.locationObj.poiName = res.address?res.address.poiName:"";  
                },  
                complete:function(res) {  
                    console.log(res)  
                }  
            });

预期结果:

获取到经纬度

实际结果:

直接报错errMsg: 'getLocation:fail network error'

bug描述:

h5配置了高德key以及秘钥 uni.getLocation 直接返回errMsg: 'getLocation:fail network error'

2022-11-26 20:02 负责人:无 分享
已邀请:
DCloud_UNI_WZF

DCloud_UNI_WZF

H5 高德地图 getLocation 失败 临时解决方案:使用附件替换文件
注意:非本地服务需要部署在 https 下,否则会报错 Geolocation permission denied https://console.amap.com/dev/ticket/type/14

  • mmonke

    附件替换文件是说在本地调试用的吗 我替换了好像也不行

    2023-11-28 14:06

  • DCloud_UNI_WZF

    回复 mmonke: 最新 HBuilderX 已修复该问题

    2024-02-19 15:36

要回复问题请先登录注册