报错过程


已经在uni-app的 manifest.json 中写入配置

/* 小程序特有相关 */
    "mp-weixin" : {
        ...
        "permission" : {
            "scope.userLocation" : {
                "desc" : "为了给您提供精准的打卡服务,我们需要获取您的地理位置信息"
            }
        },
        "requiredPrivateInfos" : [ "getLocation" ]
    },

发现小程序中运行居然会报错:

解决方法


手动在小程序的app.json添加:

{
  ...
  "permission": {
    "scope.userLocation": {
    "desc": "使用定位功能"
       }
   },
  "requiredPrivateInfos": [
    "getLocation"
   ],
  "usingComponents": {}
}