wx.getLocation在微信开发者工具里面调用成功,但预览、真机测试调用的时候安卓返回fail
发布于 7 年前 作者 gduan 4467 次浏览 来自 官方Issues

wx.getLocation,在微信开发者工具里面调用成功,但预览、真机测试、体验版调的时候安卓返回fail,已开启位置授权,手机也开启了定位服务

getLocation() {
    var that = this
    wx.getLocation({
      type: 'gcj02 ',
      success(res) {
        console.log(res)
        that.setData({
          latitude: res.latitude,
          longitude: res.longitude
        })
        that.data.covers.push({
          id: 0,
          latitude: that.data.latitude,
          longitude: that.data.longitude,
          iconPath: 'https://zysd-shanghai.oss-cn-shanghai.aliyuncs.com/mini-program/bdtui/shop/currlocation.png',
          zIndex: '999',
          rotate: 0,
          width: 20,
          height: 20
        });
      },
      fail(err) {
        console.log(err, 'fail')
      }
    })
  },
1 回复

你好,请问你解决没?我也是遇到相同问题

回到顶部