自2023.10.17之前,在uni-app编译后的 app.json 文件中配置:usePrivacyCheck: true,启用隐私相关功能。现在更新至自动启动隐私协议,涉及的 getPrivacySetting
、onNeedPrivacyAuthorization
、requirePrivacyAuthorize
等接口都需要启用隐私协议才可正常的使用!
当使用用户微信头像及昵称,或者调用copy,getLocation时,会执行fail的方法;错误的警告是指没有权限使用;
wx.getLocation({
type: 'gcj02', // wgs84
isHighAccuracy: true,
success: function success(res) {
},
fail: function fail(err) {
}
})
// :fail api scope is not declared in the privacy agreement"
需要先在小程序的后台配置,设置》服务内容声明》用户隐私保护指引,进行更新协调并提交审核
在uniapp的开发中,使用到定位的使用,需要在manifest.json
中配置其微信(mp-weixin
)的requiredPrivateInfos
有关permission
与requiredPrivateInfos
的配置使用
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false,
"es6" : false,
"minified" : true,
"postcss" : false
},
"usingComponents" : true,
"__usePrivacyCheck__" : true,
// 微信小程序接口权限相关设置,比如申请位置权限必须填此处
"permission" : {
"scope.userFuzzyLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
},
"scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位
}
},
// getLocation getFuzzyLocation
"requiredPrivateInfos" : [ "getLocation" ],
"embeddedAppIdList" : []
},
permission
微信小程序端的配置声明,requiredPrivateInfos
调用的地理位置相关隐私接口requiredPrivateInfos
中配置使用,才可调用隐私协议