uniapp获取位置时显示getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json
uniapp获取位置时显示getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json
解决方式:1.manifest.json文件 "mp-weixin" 中添加
"permission" : {
"scope.userLocation" : {
"desc" : "小程序将使用定位功能"
}
},
"requiredPrivateInfos": [
"chooseAddress",
"chooseLocation",
"choosePoi",
"getLocation",
"onLocationChange",
"startLocationUpdateBackground",
"startLocationUpdate"
]