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"
]

 

posted @ 2023-08-07 17:19  干红  阅读(1434)  评论(0编辑  收藏  举报