iphone 手机微信版本7.0.x 获取用户信息失败 , 怎么向下兼容获取用户信息?
微信版本:7.0.x 手机型号iPhone 6s Plus 通过wx.getUserProfile(Object object) 和wx.getUserInfo(Object object)都不能获取用户信息。一般的手机都能正常获取,只要遇到低版本的手机就不行了。怎么做向下兼容获取用户信息?急急急急急!!!!!代码如下 // 获取授权信息
getUserInfo(e) {
if (this.data.version) {
this.newGetUserProfile(e)
}else{
this.oldGetUserInfo(e)
}
},
// 新的API获取授权信息
newGetUserProfile() {
wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
this.data.userInfo.nickname = res.userInfo.nickName
this.data.userInfo.avatar = res.userInfo.avatarUrl
this.data.userInfo.gender = res.userInfo.gender
this.setData({
userInfo: this.data.userInfo,
openType: 'getPhoneNumber',
message: '获取手机号',
title: '您还未绑定手机号'
})
}
})
},
// 旧的API授权信息
oldGetUserInfo(e) {
wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
this.data.userInfo.nickname = res.userInfo.nickName
this.data.userInfo.avatar = res.userInfo.avatarUrl
this.data.userInfo.gender = res.userInfo.gender
this.setData({
userInfo: this.data.userInfo,
openType: 'getPhoneNumber',
message: '获取手机号',
title: '您还未绑定手机号'
})
}
})
},