佳和网络
佳和网络
  • 发布:2021-08-12 15:54
  • 更新:2022-08-09 17:12
  • 阅读:333

【报Bug】云打包升级app,新增的功能需要手动清理内存并杀死进场后才生效

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows 10 HOME

HBuilderX类型: 正式

HBuilderX版本号: 3.1.22

手机系统: Android

手机系统版本号: Android 7.0

手机厂商: 小米

手机机型: 红米4x

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

pages.json:
{
"path": "pages/garden/gardenback4",
"style": {
"navigationBarTitleText": "打印送货单",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": {
"titleAlign": "left",
"buttons": [{
"fontSrc": "/static/uni.ttf",
"text": "\ue404"
}]
}
}
}

    }  

升级代码:用的是 https://ext.dcloud.net.cn/plugin?id=3931 下载的《APP升级,在线升级支持android、ios》插件
升级部分的代码如下:
let that = this
let downloadurl = that.wgt_flag == 1 ? that.wgt_url : that.version_url
//let downloadurl = that.version_url
this.update_confirm = true
this.downloadTask = uni.downloadFile({
url: downloadurl,
success: function(res) {
console.error(res);
if (res.statusCode == 200) {
//开始安装
plus.runtime.install(res.tempFilePath, {
force: false
}, function() {
//console.log('install success...');
plus.runtime.restart();
}, function(e) {
console.error(e);
uni.showToast({
title: '升级失败:'+e.message,
icon: 'none'
});
});
} else {
uni.showToast({
title: '下载失败,网络错误',
icon: 'none'
});
}
},
fail: function(e) {
//console.log("下载失败",e)
uni.showToast({
title: '下载失败:' + e.errMsg,
icon: 'none'
});
this.update_flag = false
},
complete: function() {}
})
this.downloadTask.onProgressUpdate(function(res) {
that.update_process = res.progress
if (res.progress == Infinity) {
//使用size计算
//console.log("计算size");
let progress = (res.totalBytesWritten / that.size) * 100
if (progress > 100) {
progress = 100
}
that.update_process = progress
}
})

操作步骤:

没有

预期结果:

没有

实际结果:

没有

bug描述:

app升级后新修改的功能,例如在pages.json中增加页面,或者增加tabBar,这些都不能立即更新,需要手动结束进程后再打开app才能正常,这是什么原因?

2021-08-12 15:54 负责人:无 分享
已邀请:
小雨_0128

小雨_0128

解决了嘛,我也遇到了类似问题

要回复问题请先登录注册