当前位置:网站首页>解决小程序报错getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json
解决小程序报错getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json
2022-07-26 23:26:00 【tony康】
报错如下:

解决方案:
一、unipp项目
打开uniapp项目的配置文件manifest.json,选择“源码视图”。

光上图,不上代码的,不是好司机。
/* 小程序特有相关 */
"mp-weixin": {
"appid": "你的开发者id",
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos": [
"getLocation"
]
},二、原生小程序
打开项目的配置文件app.json。
{
"pages": ["pages/index/index"],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位
}
},
"requiredPrivateInfos": [
"getLocation"
]
}边栏推荐
- 【无标题】
- The latest multi-threaded & highly concurrent learning materials, interview confidence
- Hcip first day
- The latest JD SMS login + silly girl robot nanny level deployment tutorial (July 24, 2022)
- [brother Yang takes you to play with the linear table (4) - chain queue]
- Is it necessary to open an account on site for securities speculation? Is it safe to open an account online
- 多线程的具体使用
- [do you know cache - fully understand cache]
- hcip--ospf接口网络接口类型实验
- Encyclopedia of websites commonly used by people who know current affairs
猜你喜欢

【洋哥带你玩转线性表(四)——链式队列】

The latest multi-threaded & highly concurrent learning materials, interview confidence

After ten years of testing, I want to say to my friends who are still confused: one thing is to do a good job in personal planning

中断、信号、系统调用

I wish you a happy Chinese Valentine's day and invite you to read the source code together
![[C language] relevant distinction between strlen and sizeof](/img/c0/c026818692a01c1867771434e90da8.png)
[C language] relevant distinction between strlen and sizeof

小姐姐笔记:我是如何学习简单源码拓展视野的

It has been established for 3 years, and now goose factory has an annual income of millions +. As some suggestions of software testing predecessors

HCIP-第四天-OSPF路由协议

Redis五种基本数据结构
随机推荐
cookie增删改查方法
砺夏行动|源启数字化:既有模式,还是开源创新?
uni-app上自定义微信小程序的tabbar
Hcip OSPF comprehensive experiment
Hcip OSPF interface network interface type experiment
文章主要内容提取软件[基于NLP技术]
东北证券股票网上开户,手机上开户安全吗
无效的目标发行版:17 的解决办法
Record the nth SQL exception
Multipoint bidirectional republication and routing strategy topology experiment
NAT网络地址转换协议-拓扑实验
Hcip bidirectional republication and routing strategy
证券炒股开户需要现场开户吗网上开户安全吗
js utils 零碎
JS 数组去重(含简单数组去重、对象数组去重)
见证中国网安力量 “解码2022中国网安强星”即将启航
消息队列学习 -- 概念
从初级程序员到架构师学习路线+配套学习资源完整版
NAT network address translation protocol topology experiment
HCIP-第五天-OSPF扩展配置实验