uni.getLocation({
type: 'wgs84',
geocode: true,
success: function(res) {
util.log.debug("获取定位响应", res);
}
});
![q***@163.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/0d9184c0cb9c259b2e8973dff62d509a.png)
- 发布:2021-12-27 01:37
- 更新:2022-12-12 18:56
- 阅读:2080
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 11
HBuilderX类型: 正式
HBuilderX版本号: 3.3.3
手机系统: Android
手机系统版本号: Android 11
手机厂商: 小米
手机机型: 小米10 pro
页面类型: nvue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
{"type":"wgs84","altitude":0,"latitude":31.09073,"longitude":101.170471,"speed":0,"accuracy":64.390831,"errMsg":"getLocation:ok",address :{
....
}}
{"type":"wgs84","altitude":0,"latitude":31.09073,"longitude":101.170471,"speed":0,"accuracy":64.390831,"errMsg":"getLocation:ok",address :{
....
}}
实际结果:
{"type":"wgs84","altitude":0,"latitude":31.09073,"longitude":101.170471,"speed":0,"accuracy":64.390831,"errMsg":"getLocation:ok"}
{"type":"wgs84","altitude":0,"latitude":31.09073,"longitude":101.170471,"speed":0,"accuracy":64.390831,"errMsg":"getLocation:ok"}
bug描述:
uni.getLocation 获取不到 address 地址解析
我是今天升级了HBuilderX版本到 3.3.3 重新编译自定义基座,然后就出现这个问题,之前还是正常,仅仅只是HBuilderX升级就导致这个bug。(我使用的是高德地图)
这个bug我看社区之前的报告中看见也是反复出现这个问题,请官方工程师尽快解决,并能够彻底解决这个BUG,这个对APP开发影响很大的。
代码如下:
uni.getLocation({
type: 'wgs84',
geocode: true,
success: function(res) {
util.log.debug("获取定位响应", res);
}
});
{"type":"wgs84","altitude":0,"latitude":31.09073,"longitude":101.170471,"speed":0,"accuracy":64.390831,"errMsg":"getLocation:ok"}
![FullStack](http://img-cdn-tc.dcloud.net.cn/uploads/avatar/000/73/57/99_avatar_mid.jpg?v=1717238592)
FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
geocode Boolean 否 默认false,是否解析地址信息 仅App平台支持(安卓需指定 type 为 gcj02 并配置三方定位SDK)
q***@163.com (作者)
非常感谢问题已经解决了, type 改成 gcj02 就可以了
2021-12-27 16:34