C***@aliyun.com
C***@aliyun.com
  • 发布:2022-04-13 23:05
  • 更新:2022-04-13 23:16
  • 阅读:274

【报Bug】getLocation一直返回fali

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 11 21H2 22000.556

HBuilderX类型: Alpha

HBuilderX版本号: 3.4.5

手机系统: Android

手机系统版本号: Android 9.0

手机厂商: 模拟器

手机机型: 夜神模拟器

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
 <template>  
    <view>  
        <map :latitude="latitude" :longitude="longitude" style="width: 100%;" :style="{height: mapHeight + 'px'}"></map>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                latitude: 31.98,  
                longitude: 120.88,  
            }  
        },  
        onShow() {  
            var that = this  
            const _this = this;  
            uni.getLocation({  
                    type: 'gcj02',  
                    success: function(res) {  
                        console.log('当前位置的经度:' + res.longitude);  
                        console.log('当前位置的纬度:' + res.latitude);  
                        that.latitude = res.latitude;  
                        that.longitude = res.longitude;  
                    },  
                    fail: function(res) {  
                        console.log('定位失败')  
                    }  
                }),  
                //设置height高度  
                uni.getSystemInfo({  
                    success: (res) => {  
                        _this.mapHeight = res.screenHeight - res.statusBarHeight  
                        _this.mapHeight = _this.mapHeight  
                    }  
                })  
        },  
        methods: {  

        }  
    }  
</script>  

<style>  

</style>

操作步骤:

如示例

预期结果:

success

实际结果:

fail

bug描述:

使用官方文档中的获取定位uni.getLocation,运行安卓App基座,一直返回fail,真机测试也无法获取位置,真机小米10,安卓12,miui13.4
高德定位api和高德地图api都确认过,权限模块也都确认过

2022-04-13 23:05 负责人:无 分享
已邀请:
C***@aliyun.com

C***@aliyun.com (作者)

emmmm,没事了,解决了
重新打个包再安装。。。

该问题目前已经被锁定, 无法添加新回复