facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 907 forks source link

'React/RCTComponentEvent.h' file not found RCTFBSDKLoginButtonManager.m #580

Closed khemmapon closed 5 years ago

khemmapon commented 5 years ago

🐛 Bug Report

'React/RCTComponentEvent.h' file not found RCTFBSDKLoginButtonManager.m when I build debug in iOS

Screen Shot 2562-07-01 at 18 27 46

Environment

"react-native": "0.59.9", "react-native-fbsdk": "1.0.0-rc.4"

jdnichollsc commented 5 years ago

Same issue debugging from terminal (using 1.0.0-rc.4 and RN 0.59.9):

node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m:22:9: fatal error: 'React/RCTComponentEvent.h' file not found
#import <React/RCTComponentEvent.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Hatzl commented 5 years ago

same issue

jannisringwald commented 5 years ago

still in 1.0.0-rc.5

dsblv commented 5 years ago

1.0.0 only supports RN 0.60 and up: https://github.com/facebook/react-native-fbsdk/releases/tag/v1.0.0-rc.0

vshy108 commented 5 years ago

Yes, I build with RN0.60.3 also have this problem, the React target build seem like does not include the header file

vshy108 commented 5 years ago

I have a temporarily solution for this problem.

I add the project's node_modules/react-native/React/Base full path to Header Search Paths for the RCTFBSDK.xcodeproj in the Libraries...

and change the

#import <React/RCTComponentEvent.h> to #import <RCTComponentEvent.h>

in the

node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m

and then I can successfully build it.

IShotTheSheriff commented 5 years ago

Following @vshy108 solution I ended up getting 1366 duplicate symbols for architecture x86_64 error instead of original one :/.

--

Ok guys for everyone else struggling with this one here's what was my issue. I migrated react-native from 0.59.0 to 0.60.0 and I missed very important step - you need to unlink your react-native-fbsdk! The new version of RN will take care of autolinking it for you.

npx react-native unlink react-native-fbsdk
cd ios
pod install
Xetoxyc commented 5 years ago

I found a fix for this issue.

Open React.xcodeproj > Build Phases > Copy Headers > Add RCTComponentEvent.h

This header is also missing if i run a clean installation of react-native package 0.60.0

Xetoxyc commented 5 years ago

I found a fix for this issue.

Open React.xcodeproj > Build Phases > Copy Headers > Add RCTComponentEvent.h

This header is also missing if i run a clean installation of react-native package 0.60.0

I recreated my full project with npx react-native init und started using npx react-native run-is and cocoa pods... With using pods and npx the error is gone. It seems like its pretty "complicated" to upgrade 0.59 -> 0.60.

I suggest to invest some time and recreate your project with npx and pods... this also activates autolinking

msqar commented 5 years ago

@Xetoxyc you saved me!!! thanks

leandrolimasi commented 5 years ago

I found a fix for this issue.

Open React.xcodeproj > Build Phases > Copy Headers > Add RCTComponentEvent.h

This header is also missing if i run a clean installation of react-native package 0.60.0

this approach worked for me, but my pipeline never gets the fix to build the app because the fix was introduced in "node_modules/react-native/React" folder which is cleared before every build. Is there another solution for that?

Xetoxyc commented 5 years ago

I found a fix for this issue. Open React.xcodeproj > Build Phases > Copy Headers > Add RCTComponentEvent.h This header is also missing if i run a clean installation of react-native package 0.60.0

this approach worked for me, but my pipeline never gets the fix to build the app because the fix was introduced in "node_modules/react-native/React" folder which is cleared before every build. Is there another solution for that?

Try https://github.com/facebook/react-native-fbsdk/issues/580#issuecomment-512785354 this seems to be the only working solution right now.

msqar commented 5 years ago

Guys, after properly installing 0.60.5 and latest FBSDK with cocoapods as @Xetoxyc suggested, this was no longer a problem. I had no issues related to React nor ComponentEvent.h missing. I just run pod install and everything works smooth.

karltaylor commented 5 years ago

1.0.0 only supports RN 0.60 and up: https://github.com/facebook/react-native-fbsdk/releases/tag/v1.0.0-rc.0

This would be great on the README.md 🙂

BaderSerhan commented 4 years ago

I found a fix for this issue.

Open React.xcodeproj > Build Phases > Copy Headers > Add RCTComponentEvent.h

This header is also missing if i run a clean installation of react-native package 0.60.0

This works for me but I have to manually do it after every yarn add or npm install. The header should be added to React on its new release.