收藏
回答

wx.getUserProfile在真机调试中永远返回“微信用户”匿名用户信息,开发环境运行没事?

在开发环境运行一切正常,但是真机调试,或者上传为体验版运行,获取用户昵称永远得到“微信用户”。

<button bindtap="getUserProfile" disabled='{{btnDisabled}}'    class="btn"> 重新设置头像昵称 </button>

getUserProfile(e) {
    wx.getUserProfile({
      desc: '用于完善用户资料', 
      success: (res) => {
        console.log("getUserProfile success:", res)
      }
    })
  },


日志(res的值):

getUserProfile success: 
{cloudID: , encryptedData: "sZEE76thK12h/pm7DKuvvfatY1Bfh5HW4VUkkuTYwr/x5x+RkciSvFFa03bbT/jmPqhEYZabky+ziwrrTjZA0460QlA/cIcx4IGjIRpmXlzFEwQQKvI4rNQZXU0k1Tvjtdkn/oCHn/R9HLVe6fQegPie+maoe3nYTbKykp46CJR4ehuYP031IqXAixVN0n+r5sxZ9JDB8yNJ43KffRH4O0XeRxKkz3SWRyJFlf/PIdld/Mic+lk5I/r7Wn3b1PkrGoLO2qy3UyEiHm1vxdIF/bWLjzmX8nuPaEjBAHWM7nCMiKnEFdv1OlhKtKKR5SqhSXkc3P3VL1EWQthfe4quXCnxaQQEUQgw1bXb+0USXRHpJ2nXFGDdtDYNRK+n6eu7dVQAJFc45JR6GyWPQODCU0uheaAioYc3jV8mgLowlYlHxWKLnQLR26EY579N+68k", iv: "CC2FCmtZuF16Hf/vNLQg==", signature: "c4c8e5b30eabe268cfeaa422e20dde5bd59", userInfo: , …}
cloudID: undefined
encryptedData"sZEE76thK12h/pm7DKuvvfatY1Bfh5HW4VUkkuTYwr/x5x+RkciSvFFa03bbT/jmPqhEYZabky+ziwrrTjZA0460QlA/cIcx4IGjIRpmXlzFEwQQKvI4rNQZXU0k1Tvjtdkn/oCHn/R9HLVe6fQegPie+maoe3nYTbKykp46CJR4ehuYP031IqXAixVN0n+r5sxZ9JDB8yNJ43KffRH4O0XeRxKkz3SWRyJFlf/PIdld/Mic+lk5I/r7Wn3b1PkrGoLO2qy3UyEiHm1vxdIF/bWLjzmX8nuPaEjBAHWM7nCMiKnEFdv1OlhKtKKR5SqhSXkc3P3VL1EWQthfe4quXCnxaQQEUQgw1bXb+0USXRHpJ2nXFGDdtDYNRK+n6eu7dVQAJFc45JR6GyWPQODCU0uheaAioYc3jV8mgLowlYlHxWKLnQLR26EY579N+68k"
errMsg"getUserProfile:ok"
iv"CC2FCmtZuF16+KHf/vNLQg=="
rawData"{"nickName":"微信用户","gender":0,"language":"","city":"","province":"","country":"","avatarUrl":"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132","is_demote":true}"
signature"c4c8e5b30eabe268cfeaa422e20ddead0fb5bd59"
userInfo: Object
avatarUrl"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"
city""
country""
gender0
is_demote: true
language""
nickName"微信用户"
province""
__proto__: Object
__proto__: Object


测试微信版本:8.0.37

最后一次编辑于  2023-05-07
回答关注问题邀请回答
收藏

4 个回答

登录 后发表内容