代码如下:
wx.chooseLocation({
success: res => {
console.log('选择的位置信息:', res);
// 将选中的位置名称赋值给所属社区
state.model.community = res.name || res.address || '';
sheep.$helper.toast('已选择位置');
},
fail: err => {
console.error('选择位置失败:', err);
if (err.errMsg && err.errMsg.includes('authorize')) {
sheep.$helper.toast('需要授权地理位置权限');
} else {
sheep.$helper.toast('选择位置失败,请重试');
}
}
});
报错:{errMsg: "chooseLocation:fail api scope is not declared in the privacy agreement", errno: 112}

{
"pages": ["pages/index/index", "pages/xxx/xxx"],
"requiredPrivateInfos": ["chooseLocation"]
},app.json里面加
"getLocation",
"chooseLocation"
],