lisong / code-push-cordova-demo-app Goto Github PK
View Code? Open in Web Editor NEWcordova code-push 热更新例子
cordova code-push 热更新例子
问题描述: 在安卓平台下正常热更新升级,相同代码在IOS平台没有任何作用
请问@lisong IOS平台需要额外的配置么?
后端自己在阿里云上搭建的code push server
前端按照 这个demo的步骤提交代码,打开app 没有得到任何更新
捕获报错:
An update is available, but it is being ignored due to have been previously rolled back.
现象描述:
每次重启应用都会提示要更新,当安装更新之后调用codePush.restartApplication(), 无限弹出更新提示框, 一直循环更新。
主要代码如下:
// 检查是否有新的更新
checkSyncImmediate() {
codePush.checkForUpdate((update) => {
console.log('-------' + update)
// 如果有更新,则弹出更新提示框, 提示用户进行更新app操作
if (update) {
this.modalVisible = true
let updateDescription = update.description
if (updateDescription) {
this.updateInfoList = updateDescription.split(',')
}
// 是否强制更新,暂时未处理
this.isMandatory = update.isMandatory
}
})
},
// 立即更新
_immediateUpdate() {
this.immediateUpdate = true
// 开始同步热更新app
codePush.sync(
this.codePushStatusDidChange,
{
updateDialog: false,
installMode: InstallMode.IMMEDIATE,
mandatoryInstallMode: InstallMode.IMMEDIATE
},
this.downloadProgress
)
},
// 下载进度
downloadProgress(downloadProgress) {
if (this.immediateUpdate && downloadProgress) {
let currProgress = parseFloat(downloadProgress.receivedBytes / downloadProgress.totalBytes).toFixed(2)
if(currProgress >= 1) {
// 更新部分下载完成后,重启应用
codePush.restartApplication()
this.modalVisible = false
} else {
// 进度条赋值
this.currentPercentage = Math.ceil(currProgress * 100)
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.