The problem of uploading multiple pictures in Wechat's official account JS-SDK

use the interface for taking pictures or selecting pictures from mobile albums + the interface for uploading pictures. There is no problem with previewing when uploading multiple images, and you can all come out. But when uploading, the ios phone can only upload the last picture successfully, while the android phone has no problem, all can be uploaded successfully. Has anyone encountered this problem? The code is as follows:

wx.chooseImage({
            success: function (res) {
                var localId = res.localIds;
                for (var i = 0; i < localId.length; iPP) {
                    str_pics += "<img src="" + localId[i] + "" id="" + localId[i] + ""/>";
                    wx.uploadImage({
                        localId: localId[i].toString(),
                        isShowProgressTips: 1,
                        success: function (res) {
                            $("-sharpimgs_area").append("<input name="media_ids[]" type="hidden" value="" + res.serverId + "">");

                        }
                    });
                }
                $("-sharpimgs_area").append(str_pics);


            }
        });

I have just tested the iPhone mobile phone photo upload and uploaded two pictures without any problem, but as long as you choose an album, you can only upload the last one all the time

.

https://codeshelper.com/a/11.

resolved
var localIds = [];
    wx.chooseImage({
        count:   9,
        success: function(res) {
            localIds = res.localIds;
            syncUpload();
        }
    });
    function syncUpload() {
        if (!localIds.length) {
            alert('!');
        } else {
            var localId = localIds.pop();
            wx.uploadImage({
                localId: localId,
                success: function() {
                    syncUpload();
                }
            });
        }
    }

Hello, landlord, can you post a complete clip of "upload multiple pictures at a time"?

Menu