描述
我将代码放在适当的位置以进行无线更新,看起来代码确实推送了,但每次我运行时:
code-push deployment ls XXXXX
我得到:
有效:0%(XXX 中的 1 个)总计:0(XXX 待定)
“待定”永远不会切换到成功(但我确实看到了应用程序更新?)
再生产
我正在使用 Ionic 应用程序 (+Redux) 已放入我的 app.component.ts:
platform.ready().then(() => { this.ngRedux.dispatch(update()); });
update() 在另一个文件中:
const changeUpdateStatus = status => ({
type: 'UPDATE_STATUS',
payload: status
});
export const update = () => dispatch => {
dispatch(changeUpdateStatus('INIT'));
let sync = () => {
let codePush = (<any>window).codePush;
let SyncStatus = (<any>window).SyncStatus;
if(!codePush){
throw new Error('Code push not installed');
};
const keys = {
'iOS': env.codePushKeys.ios,
'Android': env.codePushKeys.android
};
const deploymentKey = keys[(<any>window).device.platform];
console.log('Trying to sync code push using key: ', deploymentKey);
codePush.sync(
(status) => {
console.log('status:', status);
switch (status) {
case SyncStatus.UPDATE_INSTALLED:
dispatch(changeUpdateStatus('DONE'));
break;
case SyncStatus.CHECKING_FOR_UPDATE:
dispatch(changeUpdateStatus('CHECKING'));
break;
case SyncStatus.DOWNLOADING_PACKAGE:
dispatch(changeUpdateStatus('DOWNLOADING'));
break;
case SyncStatus.INSTALLING_UPDATE:
dispatch(changeUpdateStatus('INSTALLING'));
break;
default: //ERROR, UP_TO_DATE
dispatch(changeUpdateStatus('DONE'));
break;
}
},
{
deploymentKey,
installMode: (<any>window).InstallMode.IMMEDIATE,
mandatoryInstallMode: (<any>window).InstallMode.IMMEDIATE
},
(downloadProgress) => {
// TODO: Add progress to state.
if (downloadProgress) {
console.log("Downloading " + downloadProgress.receivedBytes + " of " + downloadProgress.totalBytes);
}
}
);
}
sync() && onEvent("resume").then(sync).catch( (e) => {
dispatch(changeUpdateStatus('DONE'));
analytics.logError(e);
});
};
附加信息 cordova-plugin-code-push 版本:1.11.0
已安装插件列表:
<plugin name="cordova-plugin-camera" spec="^3.0.0" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-device" spec="^1.1.7" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
<plugin name="cordova-plugin-contacts" spec="^3.0.0" />
<plugin name="cordova-plugin-camera-preview" spec="^0.9.0" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.0" />
<plugin name="cordova-plugin-background-upload" spec="^1.0.6" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.0" />
<plugin name="cordova-sms-plugin" spec="^0.1.11" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.1" />
<plugin name="cordova-plugin-code-push" spec="~1.11.0" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="phonegap-plugin-push" spec="^2.1.2">
<variable name="FCM_VERSION" value="11.0.1" />
</plugin>
<plugin name="cordova-android-support-gradle-release" spec="^1.2.0">
<variable name="ANDROID_SUPPORT_VERSION" value="26.+" />
</plugin>
<plugin name="cordova-plugin-globalization" spec="^1.0.7" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
科尔多瓦版本:7.1.0
iOS/Android/Windows 版本:全部
这会在调试版本或发布版本上重现吗?是的
这是在模拟器上重现,还是仅在物理设备上重现?是的