美文网首页
微信公众号ios 苹果手机 wx.getLocation报错 提

微信公众号ios 苹果手机 wx.getLocation报错 提

作者: 轩轩小王子 | 来源:发表于2023-03-15 19:43 被阅读0次
1.检查appid是没有问题的
2.最后分析可能是初始化还没完成,就去调了微信相关的api,所以尝试用setTimeout加延时,问题解决(如果微信初始化跟wx.getLocation相差时间很短,可适当延长延时时间)
setTimeout(() =>{
    wx.getLocation({
        type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
        success: res => {
        },
        fail: res => {
          console.error(res);
                            
      }
    });
},1000)

码字不行,辛苦大佬,关注一下吧

image.png

相关文章

网友评论

      本文标题:微信公众号ios 苹果手机 wx.getLocation报错 提

      本文链接:https://www.haomeiwen.com/subject/rsolrdtx.html