uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: (res) => {
console.log('定位成功:', res);
},
fail: (res) => {
console.log(res);
}
})
- 发布:2023-06-06 16:25
- 更新:2023-06-06 16:55
- 阅读:373
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: mac OS 13.4
HBuilderX类型: 正式
HBuilderX版本号: 3.8.4
手机系统: iOS
手机系统版本号: iOS 16
手机厂商: 苹果
手机机型: iPhone 12mini
页面类型: nvue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
进入系统调用uni.getLocation,获取位置
进入系统调用uni.getLocation,获取位置
预期结果:
{
"type": "gcj02",
"altitude": 0,
"latitude": 30.63308,
"longitude": 103.974236,
"speed": 0,
"accuracy": 30,
"address": {
"country": "中国",
"province": "四川省",
"city": "成都市",
"district": "武侯区",
"street": "武青西四路",
"streetNum": "360号",
"poiName": "武侯区人民政府政务服务中心",
"cityCode": "028"
},
"errMsg": "getLocation:ok"
}
{
"type": "gcj02",
"altitude": 0,
"latitude": 30.63308,
"longitude": 103.974236,
"speed": 0,
"accuracy": 30,
"address": {
"country": "中国",
"province": "四川省",
"city": "成都市",
"district": "武侯区",
"street": "武青西四路",
"streetNum": "360号",
"poiName": "武侯区人民政府政务服务中心",
"cityCode": "028"
},
"errMsg": "getLocation:ok"
}
实际结果:
{
"type": "gcj02",
"altitude": 504.4490852355957,
"latitude": 30.63295681423611,
"longitude": 103.9741899956597,
"speed": null,
"accuracy": 46,
"errMsg": "getLocation:ok"
}
{
"type": "gcj02",
"altitude": 504.4490852355957,
"latitude": 30.63295681423611,
"longitude": 103.9741899956597,
"speed": null,
"accuracy": 46,
"errMsg": "getLocation:ok"
}
bug描述:
app ios端 使用uni.getLocation 获取位置未解析地址
1 个回复
DCloud_iOS_WZT
iOS系统定位不支持 反地理编码 你可以勾选高德或者百度获取详细位置信息