getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json

报错现象
image.png
解决方案

打开uniapp项目的配置文件manifest.json,选择“源码视图”。


image.png
上代码
/* 小程序特有相关 */
    "mp-weixin": {
        "appid": "",
        "setting": {
            "urlCheck": true,
            "es6": true,
            "minified": true
        },
        "usingComponents": true,
        "permission": {
            "scope.userLocation": {
                "desc": "更加精准的推荐检测站位置"
            }
        },
        "requiredPrivateInfos": [
            "getLocation"
        ]
    },
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容