Current behavior
1.I had updated sucess once on my device using codepush
CodePushDownloadProgress with no listeners registered.","[CodePush] 未能移除“unzipped”,因为您没有访问它的权限。","[SSZipArchive] Set attributes failed for directory: /var/mobile/Containers/Data/Application/3A09BB31-977D-4E50-97AE-E07929FD7BBA/Library/Application Support/CodePush/unzipped/RN/main.jsbundle.meta." ,"[CodePush] Update is invalid - A JS bundle file named "main.jsbundle" could not be found within the downloaded contents. Please ensure that your app is syncing with the correct deployment and that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary." CodePush
codePush.sync({
updateDialog: false,
installMode: codePush.InstallMode.IMMEDIATE
},(sycnStatus)=>{
if(codePush.SyncStatus.UPDATE_INSTALLED==sycnStatus){
}
});
iOS Code
NSURL* jsCodeLocation = [CodePush bundleURLForResource:@"main" withExtension:@"jsbundle" subdirectory:@"RNBundle"];
// NSURL* jsCodeLocation = [JJReactNativeManager getRNURL];
self.rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"memberCenter" initialProperties:nil launchOptions:nil];
self.view = self.rootView;
CodePush Realease
code-push release jjtravel /Users/Gideon/Desktop/RN/ 6.1.5 --deploymentName Staging --description “test” --mandatory true
Upload progress:[==================================================] 100% 0.0s
Successfully released an update containing the "/Users/Gideon/Desktop/RN/" directory to the "Staging" deployment of the "jjtravel" app.
It's has been happened in Production environment
Thanks very much!
Hi @GideonLiu, thanks for reaching us.
[CodePush] Update is invalid - A JS bundle file named "main.jsbundle" could not be found within the downloaded contents. Please ensure that your app is syncing with the correct deployment and that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary."
Could you please confirm if you are using different deployments for releasing updates for Android and iOS?
Hi @sergey-akhalkov thanks for helping me to solve my problem.
I can ensure the JS bundle's name is same.
I'm using different app name for Android and iOS, so the deployments is different for releasing updates for Android and iOS.
CodePush updated successfully when my app is first installed, but then I uninstall it and install it again , my app will update failed . It's happen only for iOS. Android does not has this problem.
@GideonLiu, could you please try to perform code-push deployment list <appName> --format json command, then download blobUrl as zip, unzip it and see if package contents have main.jsbundle file inside? If you have a chance - please make a screenshot to show the package structure and contents.
Also I've noted, that you are using general release command to release an update, so please double check if your "/Users/Gideon/Desktop/RN/" directory also contains main.jsbundle file inside.
@sergey-akhalkov , I downloaded blobUrl as zip and unziped it , the package contents have main.jsbundle file inside. But I download the sandbox from my iPhone ,and the package contents don't have main.jsbundle file inside



@GideonLiu, seems like iOS part of CodePush SDK awaits "CodePush" folder as prefix for manifest:
https://github.com/Microsoft/react-native-code-push/blob/e1cdd90e4ee6645a138eab8a43d383a37d50ef71/ios/CodePush/CodePushUpdateUtils.m#L9
Could you please try to rename your RN folder as CodePush and let me know if it fixes your issue?
Hi @sergey-akhalkov
I have renamed your RN folder as CodePush,but it's doesn't work for me.
I download the sandbox from my iPhone ,and the package contents don't have main.jsbundle file inside





@sergey-akhalkov
I think it maybe "incremental updating"(增量更新) make it error, because it never happened first install in iPhone,but will happened when I uninstall an reinstall the app many times later.
(删除app然后重新安装几次后,会发生这个问题,所以我认为是增量更新出现了错误)
@GideonLiu, got it, seems like an issue, we are going to investigate it in order of priority and let you know if we have any news.
As of now, please increment your app version each time you reinstall it - this workaround should help you to avoid of installing diff update instead of full.
Please let me know if you have any questions.
@sergey-akhalkov thanks a lot,if you solve this issue,please let me know.
Hi @GideonLiu
Could you please clarify what do you means:
- Than I deleted and reinstall my app many times
I've tried you case with index.ios.js posted below and latest react-native-code-push all works fine for me:
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import codePush from "react-native-code-push";
class App extends React.Component {
render() {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<TouchableOpacity
style = {{height: 70, width: 200, backgroundColor: 'red'}}
onPress={() => {
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE
});
}}>
<Text>Current version: 14</Text>
</TouchableOpacity>
</View>
)
}
}
let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
App = codePush(codePushOptions)(App);
AppRegistry.registerComponent('Awesome47', () => App);
Could you please make a little example app that I can use for debug.
Thanks!
@GideonLiu
Just a friendly ping, are you still have this issue?
I find the reason. I init the ReactNative page twice ,so it will download the .zip file twice.Now I init once ,it will not roll back.
Good news)
I have the same issue (iOS), and ../Application Support/CodePush/ dir has only one file: codepush.json and its contents is only {}