H5 uni.getlocation 不能获取定位Get ipLocation failed
- Dominant language
- JavaScript
- Stars
- 41.6k
- Forks
- 3.7k
- Avg merge
- 7h 6m
- Merged PRs (30d)
- 6
Description
**问题描述**
h5 引用的高德地图的sdk 首先获取位置的授权,同意之后是没有问题的可以拿到经纬度,也可以逆解析,
但是获取位置授权拒绝,然后再浏览器中手动同意获取权限,这个时候uni.getlocation应该可以拿到经纬度的但是没有
我用的qq浏览器 手机上用微信打开的也是一样的问题
刚开始以为是位置权限浏览器缓存,但是这个缓存怎么清呢
return new Promise((resolve, reject) => {
uni.getLocation({
type: 'gcj02',
geocode: true,
success: res => {
console.log('success',res,Date.now())
localStorage.set('is_location_authorized', 'true');
resolve(res);
},
fail: err => {
console.log('err',err)
localStorage.set('is_location_authorized', 'false');
res ? resolve(res) : reject(err);
},
});
});
**预期结果**
希望在手动打开位置授权之后可以拿到经纬度
**实际结果**
getLocation:fail Get geolocation position unavailable.Get ipLocation failed.
**系统信息:**
- H5平台
**补充信息**
有没有大佬可以指导一下
Contributor guide
Assessment
This issue has not been assessed yet.