收藏
回答

updateManager.onCheckForUpdate安卓不能正常使用,苹果却能?请老师查看

updateManager.onCheckForUpdate安卓不能正常使用,苹果却能?请老师查看

(同一小程序,安卓苹果 微信版本 都是最新)

附上代码:

if (wx.canIUse('getUpdateManager')) {

      const updateManager = wx.getUpdateManager()

      updateManager.onCheckForUpdate(function (res) {

        if (res.hasUpdate) {

          updateManager.onUpdateReady(function () {

            wx.hideLoading({

              success: (res) => {},

            });

            wx.showModal({

              title: '更新提示',

              content: '存在新版本,是否升级?',

              success: function (res) {

                if (res.confirm) {

                  updateManager.applyUpdate()

                }

              }

            })

          })

          updateManager.onUpdateFailed(function () {

            // 新的版本下载失败

            wx.hideLoading({

              success: (res) => {},

            });

            wx.showModal({

              title: '更新提示~',

              content: '请您删除当前小程序,重新搜索打开完成升级。',

            })

          })

        }

        else{

          wx.hideLoading({

            success: (res) => {},

          });

          wx.showModal({

            showCancel:false,

            content: '当前是最新版本!',

            

            success (res) {

              if (res.confirm) {

return;

              }

            }

          })

        }

      })

    } else {

    

      wx.showModal({

        title: '提示',

        content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'

      })

    }

  }

回答关注问题邀请回答
收藏
登录 后发表内容