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

调用最新的wx.getUserProfile接口时没有任何反应?

在微信开发者工具中调用了wx.getUserProfile接口时没有任何的反应,开发者工具的版本是1.05.2103042,基础库是2.15.0,也试过了使用wx.getSetting来授权,授权结果返回scope.userInfo:true,调用wx.getUserProfile接口还是没有任何反应,也没有报错,也没有数据返回

wx.getUserProfile({
      lang"en",
      success(res) {
        console.log(res.userInfo)
      }
    })
    
wx.getSetting({
  success (res){
    console.log(res.authSetting)
    if (res.authSetting['scope.userInfo']) {
      // 已经授权,可以直接调用 getUserInfo 获取头像昵称
      wx.getUserProfile({
     success: function(res) {
           console.log(res.userInfo)
         }
      })
     }else{
       console.log(123)
    }
  }
})

 //最终返回的结果是:
//{scope.userInfo: true, scope.address: true, scope.invoice: true, scope.invoiceTitle: true}

网友回复

Mr.Zhao:

getUserProfile 只能通过点击按钮触发

评论 抢沙发

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

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

云免签H5支付