React-native-code-push: 'CodePush.h' file not found

Created on 6 Jan 2017  路  15Comments  路  Source: microsoft/react-native-code-push

  • react-native-code-push version: v1.16.1-beta
  • react-native version: v0.40.0
  • iOS/Android/Windows version: iOS
  • Does this reproduce on a debug build or release build? all
  • Does this reproduce on a simulator, or only on a physical device? all
  • Repro steps and/or stack trace:
  • Execute react-native init myapp
  • Execute cd myapp then npm install --save [email protected]
  • Execute react-native link react-native-code-push
  • Then after build and run myapp using xcode I've got following error:
    image

Seems like react-native link react-native-code-push command works wrong.
Created issue in react-native repo: https://github.com/facebook/react-native/issues/11747

Most helpful comment

Check the Header Search Paths under each target. For me, it was

$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush

It should have been

$(SRCROOT)/../node_modules/react-native-code-push/ios

All 15 comments

@sergey-akhalkov I'm having the same issue, have you been able to fix it?

@SamMatthewsIsACommonName, hi! Could you please try to fix it by installing CodePush plugin manually (look at pt.6)?
I assume the issue will be fixed soon by React Native team so we wouldn't have to fix it manually.

Hi @sergey-akhalkov I ended up using an earlier version of React Native and worked fine. Cheers!

I have same problem with RN 0.40.0, RN-cli 2.0.1

/Users/anhtuank7c/Projects/reactnative/Clock/ios/Clock/AppDelegate.m:11:9: fatal error: 'CodePush.h' file not found
#import "CodePush.h"
        ^
1 error generated.


** BUILD FAILED **

I resovled by manually linking CodePush.h to iOS project.

open ios project via xcode, then scrolling to the end, press +
screen shot 2017-01-16 at 11 13 39 pm
Press Add Other
screen shot 2017-01-16 at 11 13 48 pm
Browse to node_modules/react-native-code-push/ios/CodePush/CodePush.h then press Open
screen shot 2017-01-16 at 11 14 29 pm
Now we have CodePush.h like this.
screen shot 2017-01-16 at 11 14 39 pm
run react-native run-ios and enjoy it

Thanks @anhtuank7c

I am having the same issue.

  "dependencies": {
    "react": "16.0.0-alpha.12",
    "react-native": "0.46.4",
    "react-native-code-push": "^4.1.0-beta"
  },

screenshot 2017-07-21 10 29 06

It was working then all of the sudden.. stop working. It is frustrating. Is there something I should do?

Check the Header Search Paths under each target. For me, it was

$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush

It should have been

$(SRCROOT)/../node_modules/react-native-code-push/ios

Running react-native link react-native-code-push currently adds an incorrect header search path as @ujwal-setlur witnessed. If you have run that command, you will need to:

1) Follow the instructions under Manual Plugin Installation

2) Change the Header Search Paths entry for code-push to $(SRCROOT)/../node_modules/react-native-code-push/ios

This was the output I got related to CodePush when I did react-native link:

rnpm-install info Android module react-native-code-push is already linked
rnpm-install info iOS module react-native-code-push is already linked
"CodePush.h" header already imported.
"jsCodeLocation" already pointing to "[CodePush bundleURL]".
Could not determine correct xcode proj path to retrieve related plist file, there are multiple xcodeproj under the solution.
"CodePushDeploymentKey" already specified in the plist file.
"getJSBundleFile" is already overridden
"codepush.gradle" is already linked in the build definition

None of the above solutions worked for me.

@anhtuank7c did you uninstall codepush first before manually installing it? If so, how did you go about doing so?

I get this when I try to link CodePush.h:

warning: skipping file '/Users/jackmead/Documents/Workspace/tesseract-mobile/node_modules/react-native-code-push/ios/CodePush/CodePush.h' (unexpected file type 'sourcecode.c.h' in Frameworks & Libraries build phase)

Manual configuration worked for me.

Had to do what you advised @mcrowe to get it running. Thanks for sharing the solution!

After npm install react-native-code-pushandreact-native link react-native-code-push runningpod installinside ios directory fixed my issue.

Check the Header Search Paths under each target. For me, it was

$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush

It should have been

$(SRCROOT)/../node_modules/react-native-code-push/ios

It works for me

Happened to me today with a fresh install of NPM v12.6.0 via NVM and following the instructions using react-native-link here: https://docs.microsoft.com/en-us/appcenter/distribution/codepush/react-native#getting-started

The Library import of CodePush and library binary libz.tbd linking had not been done, but the code transform of return [CodePush bundleURL]; had been done, as well as the Info.plist updates.

EDIT: Just followed the manual install instructions and it's still not working. I also did the pod install in the ios folder just for hecks since someone else said it resolved their issues.

EDIT 2: After performing the manual steps, I had to clean my build folder and rebuild the project. Seems to be up and running now.

@vitozyf Could you give a quick run down on how exactly you update the paths? I'm not sure how to do it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quanzaiyu picture quanzaiyu  路  3Comments

panarasi picture panarasi  路  4Comments

Phredward picture Phredward  路  3Comments

Adr1ann picture Adr1ann  路  3Comments

vira-khdr picture vira-khdr  路  3Comments