iOS更新中使用showModal时,出现模态框闪关
发布于 5 年前 作者 qiangdu 19940 次浏览 来自 问答

const updateManager = wx.getUpdateManager()

updateManager.onCheckForUpdate(function (res) {

    // 请求完新版本信息的回调

    if (res.hasUpdate) {

        updateManager.onUpdateReady(function () {            

            wx.showModal({

                title: ‘更新提示’,

                content: ‘新版本已经准备好,是否重启应用?’,

                success: function (res) {

                    if (res.confirm) {

                    // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启

                        updateManager.applyUpdate()

                    }

                }

            })

        })

    }

iOS更新时,showModal提示框闪一下就消失了,导致没有立即更新。安卓没有问题。。

请问各路大神有遇到过吗?怎么解决。。。

2 回复

wx.showModal({

    title: ‘更新提示’,

    content: ‘新版本已经准备好,是否重启应用?’,

    success: function (res) {

    if (res.confirm) {

        // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启

        updateManager.applyUpdate()

    }

    }

})

setTimeout(()=>{

    wx.hideLoading();

    wx.hideToast();

}, 1000)

楼主你onshow这一样写,然后用ios看,就会看到闪退了~

这个我以前也遇到过,你检查一下是不是在什么地方用了wx.hideloding

回到顶部