Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CodePush.h' file not found #662

Closed
sergey-akhalkov opened this issue Jan 6, 2017 · 16 comments · Fixed by #665
Closed

'CodePush.h' file not found #662

sergey-akhalkov opened this issue Jan 6, 2017 · 16 comments · Fixed by #665

Comments

@sergey-akhalkov
Copy link
Contributor

sergey-akhalkov commented Jan 6, 2017

  • 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:
  1. Execute react-native init myapp
  2. Execute cd myapp then npm install --save react-native-code-push@1.16.1-beta
  3. Execute react-native link react-native-code-push
  4. 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: facebook/react-native#11747

@SamMatthewsIsACommonName

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

@sergey-akhalkov
Copy link
Contributor Author

sergey-akhalkov commented Jan 9, 2017

@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.

@SamMatthewsIsACommonName

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

christopherdro pushed a commit to wildlifela/react-native-code-push that referenced this issue Jan 12, 2017
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 microsoft#662
@anhtuank7c
Copy link

anhtuank7c commented Jan 16, 2017

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

buptkang pushed a commit that referenced this issue Jan 20, 2017
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 #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>`
@2ducanhpham
Copy link

Thanks @anhtuank7c

@fabriziogiordano
Copy link

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?

@ujwal-setlur
Copy link

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

@mcrowe
Copy link

mcrowe commented Sep 28, 2017

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

@jackmead515
Copy link

jackmead515 commented Dec 20, 2017

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)

@dzotos
Copy link

dzotos commented May 31, 2018

Manual configuration worked for me.

@rdewolff
Copy link

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

@basha777
Copy link

basha777 commented May 9, 2019

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

@vitozyf
Copy link

vitozyf commented May 30, 2019

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

@ghost
Copy link

ghost commented Jul 15, 2019

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.

@plaporte
Copy link

plaporte commented Aug 1, 2019

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

@mhsfh
Copy link

mhsfh commented Feb 5, 2024

i faced a similar issue, and fortunately, i could fix it

"react-native": "0.72.4",
"react-native-code-push": "^8.2.1"

you need just to add pod 'CodePush', :path => '../node_modules/react-native-code-push' as follow in ios/Podfile

target 'YourApp' do
  config = use_native_modules!
 pod 'FirebaseCore', :modular_headers => true
 pod 'CodePush', :path => '../node_modules/react-native-code-push'
 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.