let uploadTask = function (index) {
let path = imagePaths[index];
wx.uploadFile({
url: Url.commonUploadImg,
filePath: path,name: 'file',
success: function (res) {
console.log(res);
},
complete: function (res) {
console.log(res);
requestCount += 1;
if (requestCount == imagePaths.length) {
// 所有请求发送完毕
wx.hideLoading();
}
let next = index + 1;
if (next <= imagePaths.length-1) {
uploadTask(next);
}
}
});
}
uploadTask(0);
场景: 选择完图片之后串行上传
问题: 模拟器可以成功请求,但是真机报错:
uploadTask createFailed. ........Send Sync
请问是我代码写的有问题吗,并行上传都没有问题,结果串行发生问题了。