2***@qq.com
2***@qq.com
  • 发布:2024-03-06 16:26
  • 更新:2024-03-06 16:26
  • 阅读:668

【报Bug】uni.getLocation 使用 type: "gcj02" 报错

分类:uni小程序sdk

产品分类: uni小程序SDK

手机系统: iOS

手机系统版本号: iOS 17

手机厂商: 苹果

手机机型: iPhone 12

页面类型: vue

SDK版本号: 3.9.9

操作步骤:

uni.getLocation({
type: "gcj02",
geocode: true,
success: function (res) {
console.log(res)
},
fail: (err) => {
uni.showToast({
title:'定位失败',
icon:"none",
})
console.log(JSON.stringify(err))
}
});

预期结果:

可正常返回定位信息

实际结果:

报错 jsLog: {"errMsg":"getLocation:fail getLocation:fail Not Support CoordsType,https://ask.dcloud.net.cn/article/282"} at components/zl-map/zl-map.vue:164

bug描述:

复制代码uni.getLocation({  
        type: "gcj02",  
        geocode: true,  
        success: function (res) {  
            console.log(res)  
        },  
        fail: (err) => {  
            uni.showToast({  
                title:'定位失败',  
                icon:"none",  
            })  
            console.log(JSON.stringify(err))  
        }  
    });

在 uni 代码中使用以上方法 ios 中返回错误

jsLog: {"errMsg":"getLocation:fail getLocation:fail Not Support CoordsType,https://ask.dcloud.net.cn/article/282"} at components/zl-map/zl-map.vue:164

请问如何处理
type: "gcj02",不传的话可以获取到位置 但在搞得地图中渲染是偏离的

2024-03-06 16:26 负责人:无 分享
已邀请:

要回复问题请先登录注册

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容