Awn Ali
Awn Ali

Reputation: 1379

Code push not updating app on IOS device

My code-push is working on simulator but when i ran same app on device it shows me update dialog but when i press install nothing happens.

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)

Additional Information

Upvotes: 1

Views: 4111

Answers (1)

Awn Ali
Awn Ali

Reputation: 1379

I solved it after so many hours, and then wrote an article so that others won't spend that much time on this simple thing.

[Tutorial] Integrate Code push with React Native (IOS & Android) Code push integration

[Tutorial] Release Build (Running on physical device) Running React Native on Ios/Android device

Upvotes: 2

Related Questions