mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
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 `react-native@0.40.0` 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 https://github.com/Microsoft/react-native-code-push/issues/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>`
This commit is contained in:
@@ -162,10 +162,6 @@ And that's it! Isn't RNPM awesome? :)
|
||||
|
||||
*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`.*
|
||||
|
||||
6. Under the "Build Settings" tab of your project configuration, find the "Header Search Paths" section and edit the value.
|
||||
Add a new value, `$(SRCROOT)/../node_modules/react-native-code-push/ios` and select "recursive" in the dropdown.
|
||||
|
||||

|
||||
|
||||
### Plugin Configuration (iOS)
|
||||
|
||||
@@ -176,7 +172,7 @@ Once your Xcode project has been setup to build/link the CodePush plugin, you ne
|
||||
1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
|
||||
|
||||
```objective-c
|
||||
#import "CodePush.h"
|
||||
#import <CodePush/CodePush.h>
|
||||
```
|
||||
|
||||
2. Find the following line of code, which loads your JS Bundle from the app binary for production releases:
|
||||
|
||||
@@ -31,15 +31,18 @@
|
||||
54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */; };
|
||||
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
|
||||
81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
|
||||
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
||||
8482F84E1E24C66300F793DB /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstPath = include/CodePush;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -190,6 +193,17 @@
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
8482F84D1E24C65E00F793DB /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8482F84E1E24C66300F793DB /* CodePush.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
58B511DA1A9E6C8500147676 /* CodePush */ = {
|
||||
isa = PBXNativeTarget;
|
||||
@@ -198,6 +212,7 @@
|
||||
58B511D71A9E6C8500147676 /* Sources */,
|
||||
58B511D81A9E6C8500147676 /* Frameworks */,
|
||||
58B511D91A9E6C8500147676 /* CopyFiles */,
|
||||
8482F84D1E24C65E00F793DB /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
||||
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
||||
|
||||
// 1. Add the header import statement
|
||||
var codePushHeaderImportStatement = `#import "CodePush.h"`;
|
||||
var codePushHeaderImportStatement = `#import <CodePush/CodePush.h>`;
|
||||
if (~appDelegateContents.indexOf(codePushHeaderImportStatement)) {
|
||||
console.log(`"CodePush.h" header already imported.`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user