app.component.ts文件
import { Component } from '@angular/core';
import { Platform,ToastController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
import { CodePush,InstallMode,SyncStatus } from '@ionic-native/code-push';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
constructor(
platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen, private codePush: CodePush,public toastCtrl: ToastController,
) {
platform.ready().then(() => {
this.codePush.notifyApplicationReady();
this.checkCodePush();
statusBar.styleDefault();
splashScreen.hide();
});
}
checkCodePush() {
this.codePush.sync({
updateDialog: {
appendReleaseDescription: true,
descriptionPrefix: "\n\nChange log:\n"
},
installMode: InstallMode.ON_NEXT_RESTART
}).subscribe(//,downloadProgress
(data) => {
if(data == SyncStatus.CHECKING_FOR_UPDATE)
alert("Check for update");
if(data == SyncStatus.DOWNLOADING_PACKAGE)
alert('downloading_package ');
if(data == SyncStatus.IN_PROGRESS)
alert('in_progress ');
if(data == SyncStatus.INSTALLING_UPDATE)
alert('installing_update ');
if(data == SyncStatus.UPDATE_INSTALLED)
alert('update_installed ');
if(data == SyncStatus.ERROR)
alert('error');
},
(err) => {
console.log('CODE PUSH ERROR: ' + err);
let toast = this.toastCtrl.create({
message: 'CODE PUSH ERROR: ' + err,
duration: 10000,
position: 'bottom'
});
toast.onDidDismiss(() => {});
toast.present();
}
);
}
}
Please see attach image 问题是在更新应用程序后,我关闭了该应用程序,并将其回滚到预览版本,但是更新没有错误。有人可以帮我吗?我该如何解决这个问题?