Reputation: 3020
Performed RN upgrade from RN0.60 to RN0.61. Build failed with iOS, due to the following issue:
/react-native/React/Base/RCTBridgeModule.h:10:9: 'React/RCTDefines.h' file not found
I am aware of this breaking changes. (React.xcodeproj is deprecated)
Try a few things
Here's how my podfile looks like.
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => '../node_modules/react-native/ReactCommon'
pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
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'
# Required by RNFirebase
pod 'Firebase/Core', '~> 6.9.0'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.14.0'
# FBSDK
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
Upvotes: 5
Views: 14758
Reputation: 1
Solved here
Upvotes: 0
Reputation: 544
I had this same issue, I went into /node_modules/react-native/React/Base/RCTBridgeModule.h and changed #import <React/RCTDefines.h> into
#if __has_include("RCTDefines.h")
#import "RCTDefines.h"
#else
#import <React/RCTDefines.h>
#endif
ref below link
https://github.com/facebook/react-native/issues/26754#issuecomment-539550146
Upvotes: 0
Reputation: 3020
Here's my solution after spending a full day in digging the reason why,
.
.
.
.
You need to add .podspec to podfile for whichever 3rd party/custom library that complain unable to find React/{whatever.h}
If you are using a 3rd party library (Yarn/NPM/etc)
Copy podspec from other 3rd party library (eg, RNDeviceInfo/etc..)
Create own podspec by replacing a few item (s.name, s.source) I actually left others as default but you can modify as per your usage if you want
s.name = "NoSupportedLib"
s.source = { :git => "https://github.com/react-native-community/NoSupportedLibName.git", :tag => "v#{s.version}" }
You might want to take care the following, because not all your dependency may store under the folder path ios/**/your.m & your.h files
s.source_files = "ios/**/*.{h,m}"
Add new line to podfile
pod 'NoSupportedLib', :path => '../node_modules/NoSupportedLib'
Pod install
In the case where you have a local dependency, you should do the same as well (instead of adding the .a file into your Xcode's Linked Framework and Libraries.)
s.source = { :http => 'file:' + __dir__ + '/' }
s.source_files = "customLib/*.{h,m}"
pod 'customLib', :path => '../localDependency/customLib'
I tried adding React under my scheme as build target, apparently it does not help. I think for project that is >=RN0.60, we are meant to use autolinking provided by ReactNative? Hence to keep our Xcode's Linked Framework and Libraries clean.
Upvotes: 8
Reputation: 1124
I've had the same issue a while ago. It was fixed after: product > scheme > edit scheme
, go to the build tab and add react
as the first target.
Upvotes: 0