ios手机小程序调用wx.chooseLocation接口的时候,获取权限的时候报authorize:fail:require permission desc这样子的错误,这是由于苹果的安全机制导致需要再app.Json加上
"permission": { "scope.userLocation": { "desc": "您的位置信息将用于添加收货地址" } }@H_403_14@
但有时还是无法获取授权,则需要在使用的地方判断是否授权,没有的话则再次提醒用户授权
chooseLocation:function(){ let _this = this; wx.chooseLocation({ success(e){ _this.setData({ map: e.longitude + ‘,‘ + e.latitude,addr: e.address }) },fail(e){ wx.showToast({ Title: e.errMsg,icon:‘none‘ }) } }) },getLocation:function(){ let _this = this; wx.getSetting({ success(res) { // 判断定位的授权 if (!res.authSetting[‘scope.userLocation‘]) { wx.authorize({ scope: ‘scope.userLocation‘,success() { _this.chooseLocation(); },fail(errMsg) { wx.showToast({ Title: JsON.stringify(errMsg),icon: ‘none‘ }) } }) } else { _this.chooseLocation(); } } }) },@H_403_14@ 总结以上是内存溢出为你收集整理的小程序调用wx.chooseLocation接口的时候无法获取权限(ios)全部内容,希望文章能够帮你解决小程序调用wx.chooseLocation接口的时候无法获取权限(ios)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)