You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+23-21Lines changed: 23 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -40,38 +40,38 @@ Once you've acquired the CodePush plugin, you need to integrate it into the Xcod
40
40
1. Open your app's Xcode project
41
41
2. Find the `CodePush.xcodeproj` file witin the `node_modules/react-native-code-push` directory, and drag it into the `Libraries` node in Xcode
42
42
43
-

43
+

44
44
45
45
3. Select the project node in Xcode and select the "Build Phases" tab of your project configuration.
46
46
4. Drag `libCodePush.a` from `Libraries/CodePush.xcodeproj/Products` into the "Link Binary With Libraries" secton of your project's "Build Phases" configuration.
47
47
48
-

48
+

49
49
50
50
5. Under the "Build Settings" tab of your project configuration, find the "Header Search Paths" section and edit the value.
51
51
Add a new value, `$(SRCROOT)/../node_modules/react-native-code-push` and select "recursive" in the dropdown.
Once your Xcode project has been setup to build/link the CodePush plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, perform the following steps:
58
58
59
59
1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
60
60
61
-
```
62
-
#import "CodePush.h"
63
-
```
61
+
```
62
+
#import "CodePush.h"
63
+
```
64
64
65
65
2. Find the following line of code, which loads your JS Bundle from the packager's dev server:
This change configures your app to always load the most recent version of your app's JS bundle. On the initial launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently applied update.
77
77
@@ -92,15 +92,15 @@ The simplest way to do this is to perform the following in your app's root compo
92
92
93
93
1. Import the JavaScript module for CodePush:
94
94
95
-
```
96
-
var CodePush = require("react-native-code-push")
97
-
```
95
+
```
96
+
var CodePush = require("react-native-code-push")
97
+
```
98
98
99
99
2. Call the `sync` method from within the `componentDidMount` lifecycle event, to initiate a background update on each app start:
100
100
101
-
```
102
-
CodePush.sync();
103
-
```
101
+
```
102
+
CodePush.sync();
103
+
```
104
104
105
105
If an update is available, a dialog will be display to the user asking them if they would like to install it. If the update was marked as mandatory, then the dialog will
Provides a simple option for checking for an update, downloading it and then applying it, all while also respecting the policy that your release was published with. This method effectively composes together the "manual mode" APIs for you, so that you don't need to handle any of the following scenarios yourself:
176
+
Provides a simple option for checking for an update, downloading it and then applying it, all while also respecting the policy that your release was published with. This method effectively composes together the "advanced mode" APIs for you, so that you don't need to handle any of the following scenarios yourself:
177
177
178
178
1. Checking for an update and displaying a standard confirmation dialog asking if they would like to install it
179
179
2. Automatically ignoring updates which have previously failed to apply (due to automatic rollback), and therefore, likely don't make sense trying to apply again (let's blacklist them!)
180
180
3. Looking to see whether an available update is mandatory, and if so, don't give the end-user the choice to ignore it
181
181
4. Displaying the description of an update to the end-user as part of the install confirmation experience
182
182
183
+
If you want to pivot whether you check and/or download an available update based on the end-user's device battery level, network conditions, etc. then simply wrap the call to `sync` in a condition that ensures you only call it when desired.
183
184
```javascript
184
185
codePush.sync(options:Object):Promise<Boolean>
185
186
```
@@ -254,6 +255,8 @@ The `RemotePackage` inherits all of the same properties as the `LocalPackage`, b
254
255
##### Methods
255
256
-__download(): Promise<LocalPackage>__: Downloads the package update from the CodePush service. Returns a Promise that resolves with the `LocalPackage`.
256
257
258
+
---
259
+
257
260
## Running the Example
258
261
259
262
* Clone this repository
@@ -265,8 +268,7 @@ The `RemotePackage` inherits all of the same properties as the `LocalPackage`, b
265
268
* Open `CodePushDemoApp.xcodeproj` in Xcode
266
269
* Launch the project
267
270
268
-
Running Tests
269
-
---
271
+
## Running Tests
270
272
271
273
* Open `CodePushDemoApp.xcodeproj` in Xcode
272
274
* Navigate to the test explorer (small grey diamond near top left)
0 commit comments