uni.getLocation({
type: 'gcj02',
geocode: true,
success: (res) => {
console.log(res);
console.log(res.address);
}
})
- 发布:2021-01-13 19:53
- 更新:2021-01-13 19:56
- 阅读:569
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 10
HBuilderX类型: 正式
HBuilderX版本号: 3.0.5
手机系统: iOS
手机系统版本号: IOS 14
手机厂商: 苹果
手机机型: 8
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
app.vue 中实时获取位置
app.vue 中实时获取位置
预期结果:
{
"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描述:
uni.getLocation在IOS端无法获得address 已设置geocode: true
IOS13.6.1,iPhone 6s Plus未复现您说的问题。是否在某个机型上必现?
也许是在特定环境下才能重现的问题,请提供可稳定复现直接运行的完整示例(上传附件),方便我们快速排查问题哦。
【bug优先级处理规则】https://ask.dcloud.net.cn/article/38139
9***@qq.com
直接用hbuildx运行正常,打包成ipa或者用离线工程打包就获取不到address
2022-08-19 16:50