Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 90f0bb8

Browse files
sergey-akhalkovbuptkang
authored andcommitted
Resolve CodePush.h for new iOS apps created with RN 0.40 (#665)
Instead of `#import "CodePush.h"`, use `#import "<CodePush/CodePush.h>` and export CodePush.h from our module. * [iOS][Build] Add `Headers` and `Copy Files` build phases Due to changes in new release of `[email protected]` there is `CodePush.h file not found` error occures. To fix it I've added `CodePush.h` header file in `Headers` and `Copy Files` build phases and changed `codePushHeaderImportStatement` variable value from `#import "CodePush.h"` to `#import <CodePush/CodePush.h>` in `postlink.js` file. Fix #662 * readme: update iOS manual plugin installation/usage documentation Due to changes in React Native v0.40.0 and changes in CodePush project Step 6. of iOS manual plugin installation (add “Header Search Paths”) is not needed anymore. Also changed path to `CodePush.h` file in `AppDelegate.m` to `#import <CodePush/CodePush.h>`
1 parent 294b46c commit 90f0bb8

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ And that's it! Isn't RNPM awesome? :)
162162
163163
*Note: Alternatively, if you prefer, you can add the `-lz` flag to the `Other Linker Flags` field in the `Linking` section of the `Build Settings`.*
164164
165-
6. Under the "Build Settings" tab of your project configuration, find the "Header Search Paths" section and edit the value.
166-
Add a new value, `$(SRCROOT)/../node_modules/react-native-code-push/ios` and select "recursive" in the dropdown.
167-
168-
![Add CodePush library reference](https://cloud.githubusercontent.com/assets/78585/20584750/bd58fd80-b230-11e6-9955-e624f12e500b.png)
169165
170166
### Plugin Configuration (iOS)
171167
@@ -176,7 +172,7 @@ Once your Xcode project has been setup to build/link the CodePush plugin, you ne
176172
1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
177173
178174
```objective-c
179-
#import "CodePush.h"
175+
#import <CodePush/CodePush.h>
180176
```
181177
182178
2. Find the following line of code, which loads your JS Bundle from the app binary for production releases:

ios/CodePush.xcodeproj/project.pbxproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@
3131
54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */; };
3232
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
3333
81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
34+
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
35+
8482F84E1E24C66300F793DB /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
3436
/* End PBXBuildFile section */
3537

3638
/* Begin PBXCopyFilesBuildPhase section */
3739
58B511D91A9E6C8500147676 /* CopyFiles */ = {
3840
isa = PBXCopyFilesBuildPhase;
3941
buildActionMask = 2147483647;
40-
dstPath = "include/$(PRODUCT_NAME)";
42+
dstPath = include/CodePush;
4143
dstSubfolderSpec = 16;
4244
files = (
45+
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */,
4346
);
4447
runOnlyForDeploymentPostprocessing = 0;
4548
};
@@ -190,6 +193,17 @@
190193
};
191194
/* End PBXGroup section */
192195

196+
/* Begin PBXHeadersBuildPhase section */
197+
8482F84D1E24C65E00F793DB /* Headers */ = {
198+
isa = PBXHeadersBuildPhase;
199+
buildActionMask = 2147483647;
200+
files = (
201+
8482F84E1E24C66300F793DB /* CodePush.h in Headers */,
202+
);
203+
runOnlyForDeploymentPostprocessing = 0;
204+
};
205+
/* End PBXHeadersBuildPhase section */
206+
193207
/* Begin PBXNativeTarget section */
194208
58B511DA1A9E6C8500147676 /* CodePush */ = {
195209
isa = PBXNativeTarget;
@@ -198,6 +212,7 @@
198212
58B511D71A9E6C8500147676 /* Sources */,
199213
58B511D81A9E6C8500147676 /* Frameworks */,
200214
58B511D91A9E6C8500147676 /* CopyFiles */,
215+
8482F84D1E24C65E00F793DB /* Headers */,
201216
);
202217
buildRules = (
203218
);

scripts/postlink/ios/postlink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
2424
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
2525

2626
// 1. Add the header import statement
27-
var codePushHeaderImportStatement = `#import "CodePush.h"`;
27+
var codePushHeaderImportStatement = `#import <CodePush/CodePush.h>`;
2828
if (~appDelegateContents.indexOf(codePushHeaderImportStatement)) {
2929
console.log(`"CodePush.h" header already imported.`);
3030
} else {

0 commit comments

Comments
 (0)