qiniu-wxapp-sdk icon indicating copy to clipboard operation
qiniu-wxapp-sdk copied to clipboard

苹果端偶尔上传不了。怎么回事?安卓端一直没问题

Open zonas1991 opened this issue 6 years ago • 6 comments

苹果端偶尔上传不了。怎么回事?安卓端一直没问题

zonas1991 avatar May 07 '19 03:05 zonas1991

报错是什么?

gpake avatar May 08 '19 03:05 gpake

奇就是奇在没报错,但就是没上传到七牛。安卓是一直上传没问题,苹果端就偶尔上传不到七牛。 上传代码如下:我没发现有什么错误呢~

initQiniu();
      var filePath = imgsrc[0];
      var img_info = "";
      if (filePath != null) {
        var fileName = filePath.split('//')[1];
        img_info = 'http://image.111111.com/' + fileName;
        // 交给七牛上传
        qiniuUploader.upload(filePath, (res) => {
          this.data.infoimg = img_info;
          this.data.place = place;
          console.log("上传封面成功");
          //提交至服务端
          wx.request({

            url: "http://localhost/api.php?do=post_child&openid=" + getApp().data.openid,
            method: "POST",
            header: { "content-type": "application/x-www-form-urlencoded" },
            data: this.data,
            complete: function (res) {
              that.setData({
                hidden: true
              })
              wx.showModal({
                title: '恭喜',
                content: '已提交成功!',
                showCancel: false,
                complete: function (res) {
                  wx.navigateTo({
                    url: '../index/index',
                  })
                }
              })
            }
          });
        }, (error) => {
          console.log("上传封面失败");
          sendpic = 1;
        });
      }

zonas1991 avatar May 08 '19 06:05 zonas1991

还是说苹果拍出的照片比较质量大,所以超过多少M上传不了?但安卓好像拍出来质量更大哦~

zonas1991 avatar May 08 '19 06:05 zonas1991

进行到哪一步卡住了呢?无论因为图片还是因为什么原因,都在 console 有错误提示,如果是卡在七牛上传,那就把返回的信息 log 出来。

gpake avatar May 10 '19 01:05 gpake

error: "bad token"。。额,就苹果偶尔会这样,安卓不会有

zonas1991 avatar May 11 '19 15:05 zonas1991

bad token 就是 token 不对呀。 js 对于安卓还是 iOS 应该没有什么明显的区别, 关注一下 token 过期时间之类的? 发自我的 iPhone

在 2019年5月11日,23:25,zonas1991 [email protected] 写道:

error: "bad token"。。额,就苹果偶尔会这样,安卓不会有

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

gpake avatar May 12 '19 08:05 gpake