microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.87k stars 1.45k forks source link

Does code-push have time delay? #349

Closed hanleirx closed 8 years ago

hanleirx commented 8 years ago

Once I renew my project, and I restart the app. But it can't renew and I need restart many times.Does it need time? And how many minutes?

lostintangent commented 8 years ago

@hanleirx Is this the same issue as #339? It would be great if you could share the details about how your app is currently configured.

hanleirx commented 8 years ago

OK,firstly I use the demo,it's efficient and I click the button,then it can renew the version.But I want renew automatically,so I change the code like this import React, { Component } from 'react'; import { AppRegistry, Dimensions, Image, StyleSheet, Text, TouchableOpacity, View, Alert } from 'react-native'; import Button from "react-native-button"; import CodePush from "react-native-code-push"; let CodePushDemoApp = React.createClass({ async sync() { let self = this; }, componentDidMount() {
try { CodePush.sync( ); } catch (error) { CodePush.log(error); } Alert.alert( 'Alert Title', 'alertMessage', ) }, getInitialState() { return { }; }, render() { let syncView, syncButton, progressView; if (this.state.syncMessage) { syncView = (

{this.state.syncMessage}
  );
} else {
  syncButton = (
    <Button style={{color: 'green'}} onPress={this.sync}>
      Start Sync!
    </Button>
  );
}
if (this.state.progress) {
  progressView = (
    <Text style={styles.messages}>{this.state.progress.receivedBytes} of {this.state.progress.totalBytes} bytes received</Text>
  );
}
return (
  <View style={styles.container}>
    <Text style={styles.welcome}>
      Welcome to CodePush!111222333444555666777888
    </Text>
    {syncButton}
    {syncView}
    {progressView}
  </View>
);

} }); let styles = StyleSheet.create({ image: { marginTop: 50, width: Dimensions.get('window').width - 100, height: 365 * (Dimensions.get('window').width - 100) / 651, }, container: { flex: 1, alignItems: 'center', backgroundColor: '#F5FCFF', paddingTop: 50 }, welcome: { fontSize: 20, textAlign: 'center', margin: 10 }, messages: { textAlign: 'center', }, }); AppRegistry.registerComponent('renewanother', () => CodePushDemoApp); when I compile it there is no errors except no renewing. And another problem is when I run this -ode-push deployment history renewanother XXX it had error-[Error] Deployment "XXX" does not exist. I don't know why.

lostintangent commented 8 years ago

What if you type "code-push deployment h renewanother Staging"? Unless you created a deployment named "XXX", that wouldn't exist for you to view history on.

Can you verify that you have configured your deployment key correctly either in your Info.plist (for iOS) or your main activity file (for Android)?

hanleirx commented 8 years ago

Yes,I have the Staging because I use this-'code-push app add renewanother' Just now I run this-'code-push deployment add renewanother IOSDevelopment',and it shows -'Successfully added the "IOSDevelopment" deployment with key ', But when I run -'code-push deployment history renewanother IOSDevelopment',it shows-' ┌───────┬──────────────┬─────────────┬───────────┬─────────────┬─────────────────┐ │ Label │ Release Time │ App Version │ Mandatory │ Description │ Install Metrics │ └───────┴──────────────┴─────────────┴───────────┴─────────────┴─────────────────┘ ' Is it right? why can it not be renewed ? I don't know the order clearly . Every time I renew the project I will run these: react-native bundle --platform ios --entry-file index.ios.js --bundle-output ./release/main.jsbundle --assets-dest ./release --dev false code-push release renewanother ./release/main.jsbundle 1.0.10 then I will restart my app what do I lack of? I need your help!

lostintangent commented 8 years ago

When you call the release command without specifying a deployment, it will default to releasing to "Staging". If you run "code-push deployment h renewanother Staging" you'll see your releases.

Also, could you try using the release-react command instead? Instead of running react-native bundle and then code-push release, just run "code-push release-react renewanother ios".

Which deployment key did you add to your app itself? It's important that the deployment you are releasing to is the same one that your app is configured with.

hanleirx commented 8 years ago

Which deployment key did you add to your app itself I don't understand what this mean.Does it mean that I push Staging to CodePushDeploymentKey in my Info.plist? And I run code-push release-react renewanother ios,then I run code-push deployment h renewanother Staging, it shows v20 │ 8 minutes ago │ 1.0.0 │ No │ │ No installs recorded . But when I restart the app its interface is no change, and I don't know why.

lostintangent commented 8 years ago

You need to ensure that the "CodePushDeploymentKey" entry in your Info.plist file is set to the key of your staging deployment. Note that this value shouldn't be "Staging". It needs to be the value that you see in the "Deployment Key" column when you run the "code-push deployment ls renewanother -k" command.

hanleirx commented 8 years ago

Yes, I know it and when I run 'code-push deployment ls renewanother -k',I can see '┌────────────────┬───────────────────────────────────────┬────────────────────────────────┬──────────────────────┐ │ Name │ Deployment Key │ Update Metadata │ Install Metrics │ ├────────────────┼───────────────────────────────────────┼────────────────────────────────┼───── ' I know the reason that it can't renew is that the time is too short so the file can't be downloaded. Thank you!

lostintangent commented 8 years ago

Ah right that might explain it :) one thing that can be helpful is to look at the debug logs for your app. The CodePush plugin logs the status of the syncing process, so you can tell when the download has completed and you can safely restart.

I'm going to close this issue for now since you figured out the problem. Sorry for the confusion, and let us know if you hit anything else.