uni-app uni.getLocation 获取速度慢 苹果6 4g网络下
uni-app uni.getLocation 获取速度慢 苹果6 4g网络下
| 类别 | 信息 |
|---|---|
| 产品分类 | uniapp/App |
| PC开发环境 | Windows |
| PC版本号 | 10 |
| HBuilderX | 正式 |
| HBuilderX版本 | 3.2.3 |
| 手机系统 | iOS |
| 手机版本号 | iOS 12.4 |
| 手机厂商 | 苹果 |
| 手机机型 | iphone 6 |
| 页面类型 | vue |
| 打包方式 | 云端 |
| 项目创建方式 | HBuilderX |
操作步骤:
upCallback(page) {
var that = this
uni.showLoading({
title: '获取位置信息...'
});
uni.getLocation({
success: function(res) {
that.longitude = res.longitude
that.latitude = res.latitude
let teams = uni.getStorageSync('yw-teams')
if (!teams) {
that.mescroll.endSuccess(0);
return
}
let teamsids = teams.map(el => el.id)
uni.hideLoading();
},
fail: function(res) {
console.log('res', res)
that.mescroll.resetUpScroll()
}
});
}
```
### 预期结果:
1s左右加载出来
### 实际结果:
10s左右加载出来
### bug描述:
4g网络下,安卓手机速度正常,苹果6大概需要10s,ios版本为12.5.4
更多关于uni-app uni.getLocation 获取速度慢 苹果6 4g网络下的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
老哥问题解决了么
更多关于uni-app uni.getLocation 获取速度慢 苹果6 4g网络下的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在iOS 12.4的iPhone 6上使用uni.getLocation获取位置信息较慢,这通常与设备硬件性能、系统定位服务机制及网络环境有关。以下是一些可能的原因和优化建议:
-
设备性能限制:iPhone 6硬件较旧,GPS模块和处理器性能可能较弱,尤其在iOS 12系统下,定位初始化或冷启动时耗时可能较长。建议测试更高版本的iOS设备(如iOS 13+)对比验证。
-
定位精度设置:uni.getLocation默认使用高精度定位(GPS+网络),在4G网络下可能因信号弱或GPS搜星慢导致延迟。可尝试调整
type参数为wgs84(仅GPS)或gcj02(网络定位),但需注意精度可能降低。例如:uni.getLocation({ type: 'gcj02', success: function(res) { /* ... */ } });

