[WeChat Mini Program] Solution to the problem that clicking the button chooseAddress() cannot jump to the delivery address

Today I encountered such a problem when I was learning the WeChat applet from a Dark Horse programmer =>
Insert image description here
I bound a click event here to implement the function of jumping to select the delivery address.
Insert image description here



However, in the actual test, this button cannot jump, and the event returns as

Insert image description here

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.
Insert image description here




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.
Insert image description here
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.
Insert image description here




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,
Insert image description here
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.

![Insert image description here](https://img-blog.csdnimg.cn/b3f9fe80ae0b4799b13cf5b90ba9d42f.png
But in this case, it cannot be run on a real machine or submitted for development =>
Insert image description here




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
Insert image description here
review is also very fast, and all passed in less than five minutes~~~
But I still can’t submit the code ORZ

Guess you like

Origin blog.csdn.net/Daears/article/details/127317430