corymsmith / react-native-fabric

A React Native library for Fabric, Crashlytics and Answers
MIT License
1.31k stars 236 forks source link

React/RCTBridgeModule.h file not found #163

Closed c100k closed 6 years ago

c100k commented 6 years ago

Hi,

Trying to setup the module on React Native 0.50.3 and React 16.0.0.

When using the pod install for iOS, I end up having React 0.11.0 loaded via CocoaPods. Is there a reason for that ?

Because in the end I have the following errors when I try to build the app

▸ Compiling SMXAnswers.m

❌  /Users/.../node_modules/react-native-fabric/ios/SMXCrashlytics/SMXAnswers.h:2:9: 'React/RCTBridgeModule.h' file not found

#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~

▸ Compiling SMXCrashlytics.m

❌  /Users/.../node_modules/react-native-fabric/ios/SMXCrashlytics/SMXCrashlytics.h:2:9: 'React/RCTBridgeModule.h' file not found

#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~

** BUILD FAILED **

Should we import the modules like this instead ?

#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#elif __has_include("React/RCTBridgeModule.h")
#import "React/RCTBridgeModule.h"
#else
#import "RCTBridgeModule.h"
#endif

If I change all the imports manually, I have my app crashing directly though. Is it a bug ?

Thanks

c100k commented 6 years ago

This might be related to https://github.com/bugsnag/bugsnag-react-native/issues/193

blackdeve commented 6 years ago

Same issue here

renatoalencar commented 6 years ago

Are you guys using CocoaPods? If you do, you need to put React Native on your Podfile and add its subspecs.

Your Podfile have to be like this https://github.com/bugsnag/bugsnag-react-native/issues/193#issuecomment-355166756

blackdeve commented 6 years ago

I am getting this error

error

renatoalencar commented 6 years ago

What's your React Native version?

blackdeve commented 6 years ago

0.51.0

renatoalencar commented 6 years ago

You added the specs just like the comment, didn't you? I think your project is in the Leanpoint directory, so your node_modules is in there. Your ios directory is inside your project directory, so change all the ./node_modules/... references your Podfile to ../node_modules/....

corymsmith commented 6 years ago

I don't think this is an issue with this lib, closing.

minhphung210 commented 6 years ago

same issue

screen shot 2018-05-16 at 2 38 55 pm
BeckyWu220 commented 5 years ago

Replace #import <React/RCTBridgeModule.h> with

#if __has_include(<React/RCTAssert.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif
Gaafar commented 5 years ago

for those having the same issue, it was fixed by adding react native CocoaPods dependencies

# The target name is most likely the name of your project.
target 'NumberTileGame' do

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

end

follow this tutorial for the latest version of the file