mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
3157b764f15ce88557fd593ea58dfae7ff5269be
react-native-code-push
React Native module for deploying script updates using the Code Push service.
Installation
npm install --save react-native-code-push
After installing the React Native Code Push plugin, open your project in Xcode. Open node_modules/react-native-code-push in Finder, and drag the CodePush.xcodeproj into the Libraries folder of Xcode.
In Xcode, click on your project, and select the "Build Phases" tab of your project configuration. Drag libCodePush.a from Libraries/CodePush.xcodeproj/Products into the "Link Binary With Libraries" secton of your project's "Build Phases" configuration.
Finally, edit your project's AppDelegate.m. Find the following code:
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
Replace it with the following:
jsCodeLocation = [CodePush getBundleUrl];
This change allows Code Push to load the updated app location after an update has been applied.
Running the Example
- Clone this repository
- From the root of this project, run
npm install cdintoExamples/CodePushDemoApp- From this demo app folder, run
npm install - Open
Info.plistand fill in the value for CodePushDeploymentKey - Run
npm startto launch the packager - Open
CodePushDemoApp.xcodeprojin Xcode - Launch the project
Running Tests
- Open
CodePushDemoApp.xcodeprojin Xcode - Navigate to the test explorer (small grey diamond near top left)
- Click on the 'play' button next to CodePushDemoAppTests
- After the tests are completed, green ticks should appear next to the test cases to indicate success
Description
Languages
C
31.1%
Objective-C
30.8%
JavaScript
11.5%
Java
10.2%
C#
9%
Other
7.3%