开发者工具地址授权点击授权之后,调用获取授权信息接口返回并未授权
1 回复
以下代码片段仅供参考:
wx.getSetting({ success(res) { if (res.authSetting[ 'scope.userLocation' ] != undefined && res.authSetting[ 'scope.userLocation' ] != true ) { wx.openSetting({ success: function (res) { if (res.authSetting[ "scope.userLocation" ] == true ) { wx.showToast({ title: '授权成功' , icon: 'success' , duration: 1000 }) wx.getLocation({ type: 'wgs84' , success: function (res) { console.log( '地理位置' , res) } }) } } }) } else if (res.authSetting[ 'scope.userLocation' ] == undefined) { wx.getLocation({ type: 'wgs84' , success: function (res) { console.log( '地理位置' ,res) } }) } } }) } |