wx.getUpdateManager不起作用
发布于 5 年前 作者 eyang 19835 次浏览 来自 问答

wx.getUpdateManager这个API麻烦检查下是不是有问题,在工具调试正常,在微信上安卓和IOS都没有效果,基本库版本代码都没有问题,麻烦官方回复下,代码:

if (wx.getUpdateManager) {
 const updateManager = wx.getUpdateManager();
 updateManager.onCheckForUpdate(function (res) {
   if (res.hasUpdate) {
     wx.showLoading({
       title: '升级中',
       mask: true
     })
     updateManager.onUpdateReady(function (res) {
       wx.hideLoading();
       wx.showModal({
         title: '升级提示',
         content: '新版本已经准备好,是否重启应用?',
         success: function (res) {
           if (res.confirm) {
             updateManager.applyUpdate()
           }
         }
       });
     });
     updateManager.onUpdateFailed(function () {
       wx.hideLoading();
       wx.showModal({
         title: '升级失败',
         content: '新版本下载失败,请检查网络!',
         showCancel: false
       });
     })
   }
 })
}
1 回复

我也不起作用啊,希望官方看到了之后尽快回复下。

这个在开发者工具中是正常的。

更新了之后,在真机上就没有看到效果。

回到顶部