uniapp ios获取位置权限 async selectAddress() { let that = this; this.show = true; this.message…
- User
uniapp ios获取位置权限 async selectAddress() { let that = this; this.show = true; this.message = '为了方便用户填写详细地址,请开启定位权限' let system = uni.getSystemInfoSync(); // 获取系统信息 if (system.platform === 'android') { let flag = await this.utils.judgeAndroidPermission(['android.permission.ACCESS_FINE_LOCATION'], '定位权限') if (flag) { console.log('进来了权限', flag) uni.chooseLocation({ success: res => { that.form.address = res.name; } }); } // plus.android.requestPermissions( // ['android.permission.ACCESS_FINE_LOCATION'], // function(e) { // if (e.deniedAlways.length > 0) { // console.log('永久拒绝') // that.show = false; // } // if (e.deniedPresent.length > 0) { // console.log('临时拒绝') // //权限被临时拒绝 // // 弹出提示框解释为何需要权限,可再次调用plus.android.requestPermissions申请权限 // that.show = false; // } // if (e.granted.length > 0) { // console.log('同意') // that.show = false; // that.nextTick(() => { // uni.chooseLocation({ // success: res => { // that.form.address = res.name; // } // }); // })
code// } // }, // function(e) { // that.show = false; // } // ); } else if (system.platform === 'ios') { } else { uni.chooseLocation({ success: res => { that.form.address = res.name; } }); } this.show = false; }, - Assistant