我的代码推送正在模拟器上运行,但是当我在设备上运行相同的应用程序时,它会显示更新对话框,但是当我按下安装时没有任何反应。
class MyApp extends React.Component {
constructor () {
super();
this.state = {
logs: []
}
}
codePushStatusDidChange(status) {
let msg = '';
switch(status) {
case codePushComponent.SyncStatus.CHECKING_FOR_UPDATE:
msg = ("Checking for updates.");
break;
case codePushComponent.SyncStatus.DOWNLOADING_PACKAGE:
msg = ("Downloading package.");
break;
case codePushComponent.SyncStatus.INSTALLING_UPDATE:
msg = ("Installing update.");
break;
case codePushComponent.SyncStatus.UP_TO_DATE:
msg = ("Up-to-date.");
break;
case codePushComponent.SyncStatus.UPDATE_INSTALLED:
msg = ("Update installed.");
break;
}
}
codePushDownloadDidProgress(progress) {
console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.");
}
update () {
codePushComponent.sync({
updateDialog: true,
installMode: codePushComponent.InstallMode.IMMEDIATE
},() => this.codePushStatusDidChange,() => this.codePushDownloadDidProgress);
}
render(){
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome
</Text>
<Text style={styles.instructions}>
Update version 1.0
</Text>
<Button title="Update" onPress={() => this.update()} />
</View>
)
}
}
export default (MyApp)
附加信息
- react-native-code-push 版本: 4.1.0-beta
- 反应原生版本: 16.0.0-alpha.12
- iOS/Android/Windows 版本: IOS 10.3
- 这会在调试版本或发布版本上重现吗? 发布
- 发布 这是在模拟器上重现,还是仅在物理设备上重现?仅限物理设备