收藏
回答

mapCtx.moveToLocation在正式版小程序中突然无法移动到指定经纬度?

小程序正式版代码在未经过修改和更新的情况下,最近一周出现了该问题.

然而在微信开发者工具中测试时不会产生该问题.到了预览与正式版的时候就会出现.报错信息为:

{errMsg: "moveToMapLocation:fail error mapid"}

请问是需要去申请开通哪些新的接口权限?或者是需要在隐私申明文件中新增哪条新的隐私协议?还是如何解决?

(在正式版中,如果moveToLocation不指定longitude与latitude参数的话则不会出现该报错,但我需要将地图的位置移动到服务器存储的已设置的位置)

代码片段:

 _mapCtx = wx.createMapContext('map');

       _mapCtx.moveToLocation({

          longitude:longitude,

          latitude:latitude,

          success:(res)=>{

            console.log(res);

            _this.data.stopInfo.longitude = longitude;

            _this.data.stopInfo.latitude = latitude;

            console.log(_this.data.stopInfo);

            _this.getAddressName(_this.data.stopInfo.longitude,_this.data.stopInfo.latitude);

          },fail:(res)=>{

            console.log(res);

          }

最后一次编辑于  08-16
回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--Asher
    社区技术运营专员--Asher
    08-18

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    08-18
    有用
    回复
  • Mandyᴸⁱ
    Mandyᴸⁱ
    11-14

    已经解决了,官方回答都是片面的。


    只需要在调用失败的时候,延迟1秒在循环调用就可以了。


    可能是部分手机性能不佳导致第一次moveToLocation失败

    11-14
    有用
    回复
登录 后发表内容