Tencent Map Series (3): Solving the problem of WeChat applet citing plug-ins

  • Question 1: When adding a plug-in to the WeChat applet, an error message is reported that the plug-in does not exist.

  • Question 2: The WeChat mini program plug-in is not authorized for use, please add the plug-in

  • Question 3: When adding plug-ins to the WeChat official account, Tencent service route planning or other plug-ins cannot be found.

  • Question 4: The addition failed. The applet category does not meet the requirements for referencing plug-ins in this category or the main type does not meet the requirements.

  • Question 5: WeChat mini program pop-up window: get plugin xxx failed, permission deny and other application failed messages

  1. Solution: Questions 2 to 5, the errors reported in the above four questions are that the WeChat public platform plug-in has not been added/added errors
  2. How to add a plug-in? Please read the article below:

  • Question 6: This key of Tencent Map does not enable the WebserviceAPI function
  1. When encountering this error, just fill in what the editor mentioned earlier WebserviceAPI is not checked
  2. Domain name whitelist: If a domain name is added, only the filled-in domain name and its subdomain names can use the key, and nothing else. (For example: https://mp.csdn.net/, then mp.csdn.net is his domain name), just don’t write this part. It means anyone can request it, no restrictions
  3. Authorized IP: Just fill in the IP address, such as 192.168.1.21…
  4. Signature verification: just understand the description

  • Question 7: Tencent location service route planning plug-in, the map keeps moving on its own in WeChat developer tools
  1. Don’t worry about this problem. The editor has already explored the solution for everyone. The problem appears in the WeChat developer tool itself. When we scan When previewing the code, the changes will not appear on the mobile phone
  • Question 8: VM56339 appservice.js:2355 key format is incorrect

A total of 3 key values ​​are used here,The key applied for Tencent location service:

WeChat applet appid:

The WeChat applet uses the appid of the plug-in: (for example, Tencent location service map point selection)

Code involved: (example)

toChooseLocation(){ // 根据文档写就可以了
	const key = '腾讯位置服务申请的key'; //使用在腾讯位置服务申请的key
    const referer = '腾讯位置服务地图选点'; //调用插件的app的名称
    const location = JSON.stringify({
      latitude: 39.89631551,
      longitude: 116.323459711
    });
    const category = '生活服务,娱乐休闲';

    wx.navigateTo({
      url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${location}&category=${category}`
    });
},

 

"permission" : {
     "scope.userLocation" : {
         "desc" : "您的位置信息将用于小程序位置接口的展示"
     }
},
"plugins": {
    "chooseLocation": {
      "version": "1.0.10",
      "provider": "微信小程序插件appid"
    }
},

Guess you like

Origin blog.csdn.net/qq_45796592/article/details/134617924