uni.getLocation({
type: 'gcj02',
geocode: true,
success: (res) => {
console.log(res);
console.log(res.address);
}
})
- 发布:2020-11-08 16:28
- 更新:2023-01-28 17:12
- 阅读:1579
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15.7
HBuilderX类型: 正式
HBuilderX版本号: 2.9.7
手机系统: iOS
手机系统版本号: IOS 14
手机厂商: 苹果
手机机型: iPhoneSE
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
新建vue页面在onReady方法中查询定位信息
新建vue页面在onReady方法中查询定位信息
预期结果:
{
"type": "GCJ02",
"altitude": 415.9051151275635,
"latitude": 34.20214870876736,
"longitude": 108.8988245985243,
"speed": null,
"address":{
"poiName":"",
"street":"",
"streetNum":"",
"province":"",
"city":"",
"district":""
}
"accuracy": 68.86002867081368,
"errMsg": "getLocation:ok"
}
{
"type": "GCJ02",
"altitude": 415.9051151275635,
"latitude": 34.20214870876736,
"longitude": 108.8988245985243,
"speed": null,
"address":{
"poiName":"",
"street":"",
"streetNum":"",
"province":"",
"city":"",
"district":""
}
"accuracy": 68.86002867081368,
"errMsg": "getLocation:ok"
}
实际结果:
{
"type": "GCJ02",
"altitude": 415.9051151275635,
"latitude": 34.20214870876736,
"longitude": 108.8988245985243,
"speed": null,
"accuracy": 68.86002867081368,
"errMsg": "getLocation:ok"
}
{
"type": "GCJ02",
"altitude": 415.9051151275635,
"latitude": 34.20214870876736,
"longitude": 108.8988245985243,
"speed": null,
"accuracy": 68.86002867081368,
"errMsg": "getLocation:ok"
}
bug描述:
版本更新到2.9.7后,uni.getLocation在IOS端无法获得address 已设置geocode: true
6 个回复
H5_flymorn
问题一样,2.9.7版本。
uni.getLocation 已配置 geocode: true ,依然没有 address:
返回如下:
希望官方及时修复。
2***@qq.com
顶楼,同样的问题,
DCloud_UNI_GSQ
旧版是否正常?
6***@qq.com (作者)
旧版正常
2020-11-09 13:51
DCloud_iOS_XHY
此问题已确认,同 https://ask.dcloud.net.cn/question/110474
6***@qq.com (作者)
map组件中的include-points属性设置后无效顺便也解决一下吧
2020-11-10 10:25
钟先生
此问题希望尽早及时处理,已对生产环境造成影响
终究会弄懂
这个问题解决了没?
6***@qq.com
解决了你就不会在这问了,哈哈。安卓有时候获取的address都是空的
2023-06-16 16:22