wx.opensetting现在不能用了吗?、一直报错,真机可以,模拟器不行
wx.showModal({ title: '定位失败,是否手动开启授权', content: '请点击确定,否则无法获取您的城市信息', success: (res) => { if (res.confirm) { wx.openSetting({ complete: (res) => { if (res.authSetting['scope.userLocation'] == true) { wx.getLocation({ success: (res) => { wx.request({ url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + ',' + res.longitude + '&', success: (res) => { this.setData({ city: res.data.result.address_component.city }) }, }) }, fail: (err) => { wx.openSetting({ success: (res) => {}, }) } }) } else if (res.authSetting['scope.userLocation'] == false) { this.setData({ city: '定位失败' }) } }, }) } else { this.setData({ city: '定位失败' }) } } })