【问题标题】:Code push not updating app on IOS device代码推送不更新 IOS 设备上的应用程序
【发布时间】:2017-08-06 08:18:11
【问题描述】:

我的代码推送正在模拟器上运行,但是当我在设备上运行相同的应用程序时,它会显示更新对话框,但是当我按下安装时没有任何反应。

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
  • 这是否会在调试版本或发布版本中重现? 发布
  • Release 是在模拟器上重现,还是仅在物理设备上重现? 仅限物理设备

【问题讨论】:

    标签: react-native react-native-android react-native-ios code-push react-native-code-push


    【解决方案1】:

    我解决了这么多小时,然后写了一篇文章,让其他人不会在这个简单的事情上花费那么多时间。

    [教程] 将代码推送与 React Native 集成(IOS & Android) Code push integration

    [教程] 发布构建(在物理设备上运行) Running React Native on Ios/Android device

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-18
      • 1970-01-01
      • 2019-05-20
      • 2011-06-23
      相关资源
      最近更新 更多