When the applet is approved, an error is reported in the current sequence: getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json

The error is as follows:

 

solution:

1. Uniapp project

Open the configuration file manifest.json of the uniapp project , and select "Source Code View".

code show as below:

 /* 小程序特有相关 */
    "mp-weixin" : {
        "appid" : "",
        "setting" : {
            "urlCheck" : false
        },
		 "usingComponents" : true,
		"permission": {
		    "scope.userLocation": {
		      "desc": "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位
		    }
		  },
	   "requiredPrivateInfos": [ "getLocation", "onLocationChange"]
    },

 The WeChat applet will automatically synchronize the configuration

 code show as below:

},
  "permission": {
    "scope.userLocation": {
      "desc": "你的位置信息将用于小程序位置接口的效果展示"
    }
  },
  "requiredPrivateInfos": [
    "getLocation",
    "onLocationChange"
  ],

Guess you like

Origin blog.csdn.net/xm1037782843/article/details/129350506