for循环上传多张图片,为何IOS系统只调用一次 wx.uploadImage?
for (; index < 10; index++) {
uploadImageSourceToWeChat(subjectExtend, index).then(function(res) {// do some work
})
}
function uploadImageSourceToWeChat(subjectExtend, orderNo) {
console.log("这里会执行多次")
return new Promise(function(resolve, reject) {
console.log("这里也会执行多次")
setTimeout(function() {
wx.uploadImage({
localId: subjectExtend.content[orderNo],
isShowProgressTips: 0,
success: function success(res) {
console.log("这里只执行一次")
},
fail: function fail() {
alert('上传微信图片失败!');
reject();
}
});
}, 100);
}
);
}