iOS apps not updating
I'm having issues with code push on iOS. If I build from Xcode to run on the device, it works fine and downloads/applied the update as expect; however if I submit to the App Store, the App Store version never updates. Android is working fine in dev mode and in Google Play.
Any suggestions on how I can pull logs from the App Store version (if that's even possible) to give you all more information on the issue?
I'm using: React Native 0.26.2 React Native Code Push 1.11.0-beta
I trigger the code push sync using this code in my main component:
export default class MyApp extends Component {
constructor(props) {
super(props);
this.appStateUpdated.bind(this);
...
}
componentWillMount() {
AppState.addEventListener('change', this.appStateUpdated);
this.appStateUpdated('active');
....
}
appStateUpdated(state) {
state === 'active' && codePush.sync({installMode: codePush.InstallMode.ON_NEXT_RESUME});
}
...
}
@codyhazelwood Hmm, interesting. The dev vs. release differences that our plugin has shouldn't impact you in this way. Could you confirm that your App Store build is configured with the right deployment key and/or that you're releasing updates to the right deployment? You can run "code-push deployment ls APP_NAME -k" to compare the keys with the one you configured with your app. Additionally, you can run "code-push deployment h APP_NAME DEPLOYMENT" to confirm that your release was made to the expected deployment.
We'll try to figure out this issue ASAP. Apologies for the inconvenience!
@lostintangent Thanks for the quick reply!
The key listed in my Info.plist under CodePushDeploymentKey does match the key returned with the code-push ls -k command. The interesting thing is that the history command shows rollbacks. Is there a way to pull logs on why it rolled back? It's odd that the App Store version is rolling back when running straight from Xcode doesn't.
@codyhazelwood OK so if you're seeing rollbacks, then that seemingly proves that the update is being downloaded and installed after all, so the deployment key wouldn't be an issue, an that rules out a few other possible issues.
The most common reason for local rollbacks are:
- An app isn't calling
notifyAppReady(orsync, which callsnotifyAppReady) on app start, and therefore, after an update is installed, the CodePush plugin thinks it failed and rolls in back. In your case, you're callingsyncon start, so that isn't an issue. Plus, you would have definitely seen that problem when doing local debugging - The update is crashing for some reason. Could you confirm that you are releasing an iOS build, using the exact same React Native version to your CodePush production deployment? For example, if you accidentally released an Android build to a deployment being used by iOS, that would lead to a crash, or if you're App Store binary was build with React Native 0.25 but you're using RN 0.26 locally.
Regarding the logs, the best things to check would be your crash reporting service (e.g. HockeyApp, Crashlytics) to see if you had any crashes in the wild. Regarding the logs, the sync method outputs a bunch of logs, but React Native "disables" them in release builds by default. Did you already try testing a release build locally? If not, that would likely be worth trying, and you can enable logs by following the instructions here. We haven't seen any issues specifically with apps distributed via a store, but it's possible that there is an issue with a release build.
I'll close the issue for now while I do some of the debugging you suggested. Thanks!
@codyhazelwood So what's the problem you find ? I have a similar problem, my app rollback and don't want tu update to the latest version I push with CodePush, I don't really understand why...
@magrinj Do either of my suggestions above match your scenario? The update won't rollback as long as it doesn't include a crash (obviously :)), and your app is calling sync or notifyAppReady on app start to notify the CodePush runtime that the update should be considered successful.
Also, can you confirm that the update you are releasing is using the exact same version of React Native (and any custom plugins) as the binary you are releasing to? If there is a mismatch, then that could lead to a crash and the update would rollback.
@lostintangent Thanks for your quick reply!
I check your suggestion, and my keys are identical. When I print my history log of all versions, I got some versions with rollback. I forgot to update my version in package.json between two version of my app, do you think that could be the problem ? Yes I just do a TestFlight update to be sure right now, so I have the same version of react-native as my simulator.
I call the sync method like that:
componentDidMount() {
// Sync CodePush with new bundle
AppState.addEventListener('change', (newState) => {
newState === 'active' && this._codePushSync();
});
AuthStore.listen(this.onChange);
}
_codePushSync() {
codePush.sync({ updateDialog: {
appendReleaseDescription: true,
descriptionPrefix: '\n\nChange log:\n',
},
installMode: codePush.InstallMode.IMMEDIATE });
}
and the log of my version looks like:
┌───────┬────────────────┬─────────────┬───────────┬─────────────┬────────────────────────┐
│ Label │ Release Time │ App Version │ Mandatory │ Description │ Install Metrics │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v1 │ 21 days ago │ 1.0 │ No │ │ No installs recorded │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v2 │ 20 days ago │ 1.1 │ No │ │ Active: 4.5% (1 of 22) │
│ │ │ │ │ │ Total: 2 │
│ │ │ │ │ │ Rollbacks: 1 │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v3 │ 20 days ago │ 1.1 │ No │ │ Active: 4.5% (1 of 22) │
│ │ │ │ │ │ Total: 2 (3 pending) │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v4 │ 20 days ago │ 1.1 │ No │ │ No installs recorded │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v5 │ 20 days ago │ 1.1 │ No │ │ Active: 0% (0 of 22) │
│ │ │ │ │ │ Total: 3 (2 pending) │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v6 │ 19 days ago │ 1.1 │ No │ │ Active: 0% (0 of 22) │
│ │ │ │ │ │ Total: 3 (1 pending) │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v7 │ 16 days ago │ 1.1 │ No │ │ Active: 18% (4 of 22) │
│ │ │ │ │ │ Total: 7 (6 pending) │
│ │ │ │ │ │ Rollbacks: 2 │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v8 │ a day ago │ 1.2 │ No │ │ No installs recorded │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v9 │ a day ago │ 1.2 │ No │ │ Active: 18% (4 of 22) │
│ │ │ │ │ │ Total: 6 (1 pending) │
│ │ │ │ │ │ Rollbacks: 1 │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v10 │ 4 hours ago │ 1.1 │ No │ │ No installs recorded │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v11 │ 4 hours ago │ 1.1 │ No │ │ Active: 4.5% (1 of 22) │
│ │ │ │ │ │ Total: 1 │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v12 │ 27 minutes ago │ 1.1 │ No │ │ No installs recorded │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v13 │ 17 minutes ago │ 1.2 │ No │ │ Active: 0% (0 of 22) │
│ │ │ │ │ │ Total: 0 (1 pending) │
├───────┼────────────────┼─────────────┼───────────┼─────────────┼────────────────────────┤
│ v14 │ a minute ago │ 1.2 │ Yes │ │ Active: 0% (0 of 22) │
│ │ │ │ │ │ Total: 0 (1 pending) │
You need to make sure that you call either _codePushSync or codePush.notifyApplicationReady in your componentDidMount event handler. Those being called is how the CodePush plugin sees the update as having been successful. With the way you are calling sync now, after an update is installed, if the app is killed (by the user or OS) before the end user ever resumes it from the background, the update won't be marked as successful and will be rolled back on the next cold start.
I would recommend just calling _codePushSync directly in your componentDidMount method (in addition to calling it in your app state change handler), since that will resolve this problem, and also have the benefit of not waiting until a resume to check for updates after the app is cold started.
Oh ok I understand, thank you very much for your help, I'm going to try it!
Looks like it works, thanks a lot @lostintangent ! :)
Awesome! I'll update our docs to make this clearer. Apologies for the confusion!
No problem! Yes I think that's gonna help some people to don't do the same error than me!
One of my issues was that I misunderstood the documentation on the version number. My app store version was 1.5.0 and I was trying to release a code push update with v1.5.1.
As far as the rollbacks go, I'm not sure what happened. I rm -rf'ed my node_modules and reinstalled and resubmitted to the app store. All appears to be good now!
I have something similar issue. My code push work fine before but I push the new version but there is no pop for the client to install new update. how I can check what is the problem?
Please help as I am on learning track of code push and have no idea why it is not loading new on device.
Thank you in advance.
Hello @itcurves and thanks for reaching us.
As I can see the current thread is too old and I'm not sure that it is completely related to you issue. This way I believe it would be best if you create a separate issue (you can find a good template here) and provide us as much info as possible about your problem and about your application. Explain what you did, what you expected to happen and what actually happens.
We are ready to help but we need more info to identify the root cause of your issue.