同一套代码,去年打包的,今年都可以正常更新,昨天发现打包新的app,无法正常更新,plus.runtime.install 安装失败 返回 code [10] error opening zip
改成旧项目的服务器,更新包能正常更新,难道是我sdk版本问题,那也不应该啊,就项目今年的更新包都能正常安装。
confirm() {
if (this.progress) return false;
console.log(11, this.downPath)
const downloadTask = uni.downloadFile({
url: this.downPath,
success: res => {
console.log('uni.downloadFile', res)
if (res.statusCode === 200) {
let path = res.tempFilePath;
plus.runtime.install(path, {
force: true
}, function() {
plus.nativeUI.closeWaiting();
this.isComplete = false
plus.nativeUI.alert("应用资源更新完成!", function() {
plus.runtime.restart();
});
}, function(e) {
console.log('install', e)
plus.nativeUI.closeWaiting();
plus.nativeUI.alert("安装更新文件失败[" + e.code + "]:" + e
.message);
if (e.code === 10) {
alert('请清除临时目录');
}
});
}
}
});
downloadTask.onProgressUpdate(res => {
this.progress = `更新中 ${res.progress}%`
});
},
0 个回复