1.官方demo
微信7.0.9以上版本&&版本基础库2.16.0上wx.getUserProfile(Object object)才可正常使用
if(微信<7.0.9){
wx.getUserProfile = false
}
if(微信>7.0.9&&基础库<2.16.0){
wx.getUserProfile 不返回 iv和加密信息
}
if(微信>7.0.9&&基础库>2.16.0){
wx.getUserProfile 正常
}
微信7.0.9以下版本请求wx.getuserinfo可以正常拿到iv和未解密的用户信息 不再弹出授权弹框
兼容可以 类似这种写法 本公司业务需求--简单demo
wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
if(!res.iv){
wx.getuserinfo({
拿到所需信息
})
}
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
官方给的demo
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
论坛吐槽区域
https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801