html52.com
我爱小程序-开发者交流社区

wx.getUserProfile调用无返回数据?

getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
    // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
    wx.getUserProfile({
      desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
      success: (res) => {
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    })
  },

直接调用getUserProfile方法 wx.getUserProfile 无返回数据,无响应。。

使用button触发getUserProfile方法,wx.getUserProfile有数据返回。why?????????

<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>


*开发工具已更新,确认支持wx.getUserProfile接口。

网友回复

|G.XIAO|:

getUserProfile 必须是用户点击才能触发

另外可以看看用户授权的前世今生https://developers.weixin.qq.com/community/develop/article/doc/000c8ce9a10070794cfbb0c085b013

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付