twofang
twofang
  • 发布:2020-08-18 17:15
  • 更新:2020-10-09 17:30
  • 阅读:1181

热更新不生效

分类:5+ SDK

更新完毕调用重启方法后app内容没有更新,而是需要再手动重启一次才行。

plus.nativeUI.showWaiting("正在更新中,请稍后...");  
plus.runtime.install(d.filename, {  
    force: true  
}, function() {  
    plus.nativeUI.closeWaiting();  
    console.log("新版本文件成功!");  
    plus.nativeUI.alert("软件应用更新完成!", function() {  
        plus.runtime.restart();   
    });  
}, function(e) {  
    console.log(e)  
    plus.nativeUI.closeWaiting();  
    console.log("更新失败[" + e.code + "]:" + e.message);  
    plus.nativeUI.alert("更新失败[" + e.code + "]:" + e.message);  
});  

测试手机:
Redmi Note 8 Pro (android 9)
vivo NEX3 (android 10)
有时调用重启后生效有时不生效。手动关掉后再打开就生效了

求大神指点

2020-08-18 17:15 负责人:无 分享
已邀请:
辉一

辉一

this.dtask=uni.downloadFile({
url:download_path,
success:(res) => {
if (res.statusCode===200){
plus.runtime.install(res.tempFilePath, {}, function() {
plus.nativeUI.alert(self.$t('update.successful'), function() {
self.persent=0;
self.doit=false;
self.$emit('closeDownload');
plus.runtime.restart();
});
}, function(e) {
plus.nativeUI.alert("安装更新文件失败[" + e.code + "]:" + e.message,function(){
self.persent=0;
self.doit=false;
self.$emit('closeDownload');
},self.$t('tip.tit'),self.$t('tip.confirm'));
if (e.code == 10) {
alert('请清除临时目录');
}
});
}
},
fail: (res) => {
plus.nativeUI.alert("下载失败!");
}
});
this.dtask.onProgressUpdate((res) => {
if (self.persent < res.progress) {
self.persent = res.progress
}
});
我的是这样的。外面再套了一层uni.downloadFile,然后才用plus.runtime.install。

5***@qq.com

5***@qq.com

我也碰到这情况,plus.runtime.restart重启没生效,要手动才行

该问题目前已经被锁定, 无法添加新回复