- 当前 Bug 的表现(可附上截图)
onLoad: function (options) {
wx.getSetting({
success(res) {
console.log(res);
console.log(res.authSetting['scope.userLocation']);
if (!res.authSetting['scope.userLocation']) {
wx.authorize({
scope: 'scope.userLocation',
success() {
// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 2000
})
wx.getLocation
},
fail:function(){
wx.showToast({
title: '授权失败',
icon: 'success',
duration: 2000
})
}
})
}else
{
wx.showToast({
title: 'fail已经授权',
icon: 'success',
duration: 2000
})
}
}
})
},
getPos:function(){
let that=this;
console.log('执行getPos方法');
wx.getLocation({
type: 'wgs84',
success(res) {
that.setData({
x: res.latitude,
y: res.longitude
})
}
})
},
测试手机:华为荣耀V9 play 【安卓7.0】
代码如上,手机设置上检测用户是否授权获取位置时,直接回调了fail,无法获取用户位置,开发工具中一切正常
- 预期表现
正常获取用户位置
- 复现路径
- 提供一个最简复现 Demo
当微信获取位置的权限被阻止后,wx.getSetting仍然执行的是success,由于如图所示的值是ture 执行了else 弹出已经授权,但实际上微信位置是不能获取的【在手机上】
fail 的 errmsg 是?
是系统没给微信授权不
昨晚查出来了,系统把微信获取位置给禁用了,需要手动打开,wx:getsetting是执行成功的,没能提示被禁用了,至少返回一个特定的值,让我们提示被禁用了吧、
getLocation的fail分支会有提示的
当微信获取位置的权限被阻止后,wx.getSetting仍然执行的是success,由于如图所示的值是ture 执行了else 弹出已经授权,但实际上微信位置是不能获取的【在手机上,因为权限被禁止了,请问怎么解决】