iPhoneSE request:fail interrupted
发布于 5 年前 作者 li33 12898 次浏览 最后一次编辑是 4 年前 来自 问答

iPhoneSE 每次请求都出现这个问题,请问该如何处理?

测试了两台服务器,一台每次都出现这个问题,一台可以正常使用,这个问题该如何排查?

下面是代码

wx.login({

  fail: function (res) {

    console.log(‘获取用户信息异常’, res)

  },

  success: res => {

    // 发送 res.code 到后台换取 openId, sessionKey, unionId

    console.log(res)

    wx.request({

      url: _this.globalData.domain +’/api/WxApp/Authenticate’,

      method: ‘POST’,

      data: {

        code: res.code

      },

      fail: function (res) {

        console.log(‘获取用户信息异常’, res)

        wx.hideLoading()

        wx.showToast({

          title: ‘获取用户信息异常’,

          icon: ‘none’

        })

      },

      success: function (res) {

        // success

        console.log(‘获取openid’,res)

        if (res.data.succeed) {

          _this.globalData.openid = res.data.data.openId;

        } else {

          var errMsg = ‘获取用户信息失败,接口返回值无错误信息’;

          if (res.data.error) {

            errMsg = res.data.error

          }

          wx.showToast({

            title: errMsg,

            icon: ‘none’

          })

          wx.hideLoading()

        }

      }

    })

  }

})

1 回复

建议更新下微信版本试下

回到顶部