问题描述

当使用这个微信开发者工具或者一些手机无法拉起弹窗获取位置信息的时候
真机调试出现chooseLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json的报错

	uni.chooseLocation({
			success: function(res) {
				console.log('位置名称:' + res.name);
				console.log('详细地址:' + res.address);
				console.log('纬度:' + res.latitude);
				console.log('经度:' + res.longitude);     
			},
			fail(err) {
				console.log(err,"776w77")
			}
		});

解决方法

manifest.json选择源码视图,
找到mp-weixin节点,
添加requiredPrivateInfos的配置
"mp-weixin" : {
    "requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
}

这样就可以正常获取到了!!!

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐