uni-app iOS 版本更新 plus.runtime.restart() 样式乱了需要重启APP
uni-app iOS 版本更新 plus.runtime.restart() 样式乱了需要重启APP
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Mac | 15.5 (24F74) | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Mac
PC开发环境操作系统版本号:15.5 (24F74)
HBuilderX类型:正式
HBuilderX版本号:4.65
手机系统:iOS
手机系统版本号:iOS 18
手机厂商:苹果
手机机型:iphone 12
页面类型:vue
vue版本:vue2
打包方式:离线
示例代码:
plus.runtime.install(download.filename, {}, function(e) {
if (plus.os.name === 'iOS') {
安装成功后, 执行 plus.runtime.restart() 无效,界面样式乱了,手动关闭应用重启正常
// try {
// plus.runtime.restart()
// } catch (e) {
// uni.showModal({
// title: '更新完成',
// content: '新版本已安装成功,iOS系统限制无法自动重启App,请手动滑动关闭App后重新打开以完成更新。',
// showCancel: false,
// confirmText: '我知道了'
// })
// }
} else {
plus.runtime.restart()
}
操作步骤:
plus.runtime.install(download.filename, {}, function(e) {
if (plus.os.name === 'iOS') {
uni.showModal({
title: '更新完成',
content: '请手动滑动关闭 App 后重新打开以完成更新',
confirmText: '我知道了',
showCancel: false,
success: () => {
plus.runtime.restart()
}
});
} else {
plus.runtime.restart()
}
popupObj.change({
contentText: "应用资源更新完成!",
buttonNum: 1,
progress: false
});
}
预期结果:
需要下载完,重刷界面,展示最新的功能
实际结果:
plus.runtime.install(download.filename, {}, function(e) {
if (plus.os.name === 'iOS') {
目前采用弹窗引导用户,但是这样很不合理
uni.showModal({
title: '更新完成',
content: '请手动滑动关闭 App 后重新打开以完成更新',
confirmText: '我知道了',
showCancel: false,
success: () => {
plus.runtime.restart()
}
});
更多关于uni-app iOS 版本更新 plus.runtime.restart() 样式乱了需要重启APP的实战教程也可以访问 https://www.itying.com/category-93-b0.html
3 回复
请问怎么解决的
更多关于uni-app iOS 版本更新 plus.runtime.restart() 样式乱了需要重启APP的实战教程也可以访问 https://www.itying.com/category-93-b0.html
坑货


