我的代码推送正在模拟器上运行,但是当我在设备上运行相同的应用程序时它会显示更新对话框但是当我按下安装时没有任何反应。
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)
其他信息
答案 0 :(得分:1)
经过这么多个小时后我解决了这个问题,然后写了一篇文章,以便其他人不会在这个简单的事情上花那么多时间。
[教程]使用React Native(IOS和Android)集成代码推送 Code push integration
[教程]发布版本(在物理设备上运行) Running React Native on Ios/Android device