华为手机调用wx.getUserProfile 报错

小程序 文章 2021-03-19 17:01 480 0 全屏看文

AI助手支持GPT4.0

华为手机调用wx.getUserProfile 报错Huawei mobile phone calls wx.getUserProfile and reports an error

华为手机调用wx.getUserProfile 报错
框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.getUserProfile 微信安卓客户端 8.0.1 2.11.2

<button bindtap="onKeyLogin">授权登录</button>

onKeyLogin(e) {

console.log("触发授权事件")

wx.getUserProfile({

desc:'同意授权',//不写不弹提示框

success:function(resData){

console.log("授权成功")

},

fail:function(err){

console.log("授权失败")

}

})

Framework type problem type API / component name terminal type wechat version basic library version applet bug wx.getUserProfile Wechat Android client 8.0.1 2.11.2 < button bindtap = "onkeylogin" > authorized login < / button > onkeylogin (E){ console.log (trigger authorization event) wx.getUserProfile ({desc: 'agree to authorize', //Don't write, don't play prompt box success:function (resData){ console.log ("authorization successful")}, fail:function (err){ console.log ("authorization failed")})

回答:

太初:

大兄弟 ~ 这个要四月份哦 还没有全面上线

太初:加canIUse
行动:这个不是由基础库决定的吗
太初:基础库也不靠谱 有的人按照官方基础库版本就调不出来 相同的版本库而我就可以调出来 只能说他还不稳定 ~  你先做个兼容
行动:我去,旧的api马上就要废弃了,新的还不稳定  这兼容也没法做了啊
太初:没事,总要有个过度的
武曲心:

getUserProfile可以正式使用了,我都改了好几个项目发布了,使用getUserProfile要满足基础库的要求,开发工具也要在1.05.2103112以上的,我是没加canIUse这些判断,直接就改了。

行动:其它的手机都是可以的,就是这一个有问题
😮😮:

可以直接判断 wx.getUserProfile 有的话 说明可以使用


-EOF-

AI助手支持GPT4.0