onLaunch (options) {
const updateManager = my.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
console.log('123456', res);
// 检查更新结果
console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function () {
my.confirm({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function (res) {
if (res.confirm) {
// 新版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function () {
// 新版本下载失败
});
}
console.log('123456', res);在ios真机调试没有触
版本更新updateManager开发模拟和安卓上都可以,在ios真机上无效
最新推荐文章于 2024-05-26 17:05:22 发布