3***@qq.com
3***@qq.com
  • 发布:2023-12-08 17:43
  • 更新:2023-12-08 18:45
  • 阅读:600

微信小程序chooseLocation方法,第一次授权后,调起地图报错,需要重新编译后才能使用

分类:uni-app

第一次授权后报错:chooseLocation:fail api scope is not declared in the privacy agreement
真机需要点击右上角三个点里面的重新进入小程序,开发工具需要重新编译才能调起地图。
代码:

toShowMapPick() {  
      const _this = this;  
      uni.getLocation({  
        type: "gcj02",  
        success: function (res) {  
          console.log("当前位置的经度:" + res.longitude);  
          console.log("当前位置的纬度:" + res.latitude);  
          uni.chooseLocation({  
            latitude: res.latitude,  
            longitude: res.longitude,  
            success: function (res) {  
              console.log('位置名称:' + res.name);  
              console.log('详细地址:' + res.address);  
              console.log('纬度:' + res.latitude);  
              console.log('经度:' + res.longitude);  

            },  
            fail: function(res){  
              console.log("------------------地图调取失败---------------------------")  
              console.log(res)  

            },  
            complete: function(res){  
              console.log("------------------地图调取结束---------------------------")  
              console.log(res)  
            }  
          });  
        },  

      });
2023-12-08 17:43 负责人:无 分享
已邀请:
YUANRJ

YUANRJ

参考 文档 的注意事项

微信小程序在2023年10月17日之后,使用API需要配置隐私协议。

要回复问题请先登录注册