wx.getLocation need to be declared in the requiredPrivateInfos field in app.json
时间: 2023-10-13 20:00:07 浏览: 99
小程序getLocation需要在app.json中声明permission字段
5星 · 资源好评率100%
The error message you mentioned is related to the WeChat Mini Program development. To fix this issue, you need to declare the `getLocation` API in the `requiredPrivateInfos` field in your `app.json` file.
Here's an example of how you can declare it:
```json
{
"requiredPrivateInfos": {
"wx.getLocation": true
}
}
```
By adding the above code to your `app.json` file, you are requesting the necessary permission for using the `getLocation` API in your WeChat Mini Program.
Please note that the `requiredPrivateInfos` field is used to declare all the APIs that require user permission. Make sure to add any other required APIs in a similar manner if needed.
Let me know if you need further assistance!
阅读全文