Today I encountered such a problem when I was learning the WeChat applet from a Dark Horse programmer =>
I bound a click event here to implement the function of jumping to select the delivery address.
However, in the actual test, this button cannot jump, and the event returns as
chooseAddress:fail the api need to be declared in …e requiredPrivateInfos field in app.json/ext.json
translation =>
chooseAddress:failed to declare api in requiredPrivateInfos field in app.json/ext.json
At first I thought it was a typo, but after searching on the official website I found that it was not a typo.
So I was wondering if any configuration had been updated, because app.json/ext.json的requiredPrivateInfos字段中声明api失败
it was obvious that some fields were missing in the app.json file, making it impossible to use this API, so I continued to search the documentation and finally found this =>
Geolocation interface newly added and Related process adjustments:
The official document says that a configuration needs to be added to the app.json file. I developed it in HBuilder X.
In the mp-weixin node of the manifest.json file, add two new configurations.
"requiredPrivateInfos": [
"getFuzzyLocation",
"choosePoi",
"chooseAddress"
],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用来进行接口调试"
}
}
If you use WeChat developer tools, it is the same. Just create a new node in app.json and add the corresponding fields as needed. What I use here is what is written in the official document.
The document says that after completing the field declaration, you need to complete the permission application in "Mini Program Management Backend - "Development" - "Development Management" - "Interface Settings";
But after I opened it,
I didn't find where to apply, so I tried running the code again and found that it could jump successfully, and the console could also correctly output the return information.
But in this case, it cannot be run on a real machine or submitted for development =>
So this problem is solved for the time being, although I think this official change is a bit confusing.
If you know how to apply for permission, please leave a message in the comment area
Supplement: If you want to apply for these interfaces, you must first fill in the service categories in the settings. After filling in the service categories related to these interfaces, you can apply for activation. The
review is also very fast, and all passed in less than five minutes~~~
But I still can’t submit the code ORZ