forked from source
- Apple allows the use of hot update [Apple's developer agreement] (https://developer.apple.com/programs/ios/information/iOS_Program_Information_4_3_15.pdf), but the provisions can not be prompted to update the user, affecting the user experience. And Google Play happens to be the opposite, you must inform the user to update. However, China's android market must close the update box, otherwise it will be in the audit application to "please upload the latest version of the binary application package" to reject the application.
- react-native different platform bundles are not the same, in the use of code-push-server must be created when the different applications to distinguish (eg. CodePushDemo-ios and CodePushDemo-android)
- react-native-code-push only update the resource file, will not update java and Objective C, so npm upgrade depends on the package version, if dependent on the use of localized package, this time must change the application version number (ios modify Info . CFBundleShortVersionString in .plist, android modifies versionName in build.gradle) and then recompiles the app to the app store.
- recommend the use of the code-push release-react command to publish the application, which combines the package and release commands (eg. Code-push release-react CodePushDemo-ios ios -d Production)
- Each time you submit a new version to the App Store, you should also publish an initial version to the code-push-server based on the submission. (Since each time a code-push-server is released, the code-puse-server compares with the initial version to generate the patch)
Api.code-push.com is just a test server, do not put their own production environment on the project, the server broadband only 1M, and the service did not do load balancing and monitoring, stability can not guarantee, please yourself build their own services The
$ code-push login http://api.code-push.com:8080 #log in$ yarn install
$ ./bin/db init --dbhost localhost --dbuser root --dbpassword PASSWORD
$ ./bin/wwwyarn install
$ ./bin/db upgrade --dbhost localhost --dbuser root --dbpassword PASSWORD
$ #restart code-push-servermust be set here:
./core/config.js
$ node ./bin/www Use code-push-cli manager CodePushServer
$ npm install code-push-cli@latest -g
$ code-push login http://127.0.0.1:3000 #login in browser account:admin password:123456react-native-code-push for react-native
$ cd /path/to/project
$ npm install react-native-code-push@latest --saveFollow the react-native-code-push docs, addition iOS add a new entry named CodePushServerURL, whose value is the key of ourself CodePushServer URL. Andriod use the new CodePush constructor in MainApplication point CodePushServerUrl
iOS eg. in file Info.plist
...
<key>CodePushDeploymentKey</key>
<string>YourCodePushKey</string>
<key>CodePushServerURL</key>
<string>YourCodePushServerUrl</string>
...Android eg. in file MainApplication.java
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(
"YourKey",
MainApplication.this,
BuildConfig.DEBUG,
"YourCodePushServerUrl"
)
);
}Use CodePush Web manage apps
ex:
$ code-push app add studioconnect-ios ios react-native
add codePushWebUrl config in ./config/config.js
eg.
...
"common": {
"codePushWebUrl": "Your CodePush Web address",
}
...MIT License read