React/Rctbridgemodule.H' File Not Found

`React/RCTBridgeModule.h` file not found

In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOS (solution was found here: Reliable build on ^0.39.2 fails when upgrading to ^0.40.0).

What happened was that Xcode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.

The solution in my case was to:

  1. Disable the parallel builds:

    • Xcode menu -> Product -> Scheme -> Manage Shemes...
    • Double click on your application
    • Build tab -> uncheck Parallelize Build
  2. Add react as a project dependecy

    • Xcode Project Navigator -> drag React.xcodeproj from Libraries to root tree
    • Build Phases Tab -> Target Dependencies -> + -> add React

react native splash screen get 'React/RCTBridgeModule.h' file not found

Instead of

#import <React/RCTBridgeModule.h>

use

#import "RCTBridgeModule.h"

Hope this helps you. Feel free for doubts.

React/RCTBridgeModule.h' file not found - React Native

I found the issue, I needed to include "use_react_native!" in my Podfile.

React/RCTBridgeModule.h' file not found in React Native 0.61.2

Instead of:

#import <React/RCTBridgeModule.h>

You typically would solve using this on 0.59x versions:

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

However, from RN >= v0.60x, we need to add .podspec to podfile for whichever 3rd party/custom library that complain unable to find React/{whatever.h}. So please, don't add the .a file into your Xcode's Linked Framework and Libraries.

To solve this, we can start doing:

  1. Copy podspec from other 3rd party library (eg, RNDeviceInfo/etc..);

  2. Create own podspec by replacing a few item (eg, s.name, s.source, s.source_files)

s.name   = "MyPayPalLib"
s.source = { :git => "https://github.com/my-super-repo/paypal-lib-repo.git", :tag => "v#{s.version}" }

.

Follow the next steps, taking care if you Library is hosted on npm/yarn/git (remote) or stored locally in your project's dir.

.

A. If Remote Library:

  1. Add this to track all your lib files:
    s.source_files = "ios/**/*.{h,m}"

  2. Add new lib to Podfile:
    pod 'MyPayPalLib', :path => '../node_modules/MyPayPalLib'

  3. Do a pod install

B. If Local Library:

  1. Create this custom.podspec at the same custom library path, you would otherwise need to modify the above s.source path as your need.
s.source       = { :http => 'file:' + __dir__ + '/' }
s.source_files = "customLib/*.{h,m}"

  1. Add new lib to Podfile:
    pod 'MyPayPalLib', :path => '../localLibFolder/MyPayPalLib'

  2. Do a pod install



SOLUTION:

After fix the error: 'React/RCTBridgeModule.h' file not found in React Native 0.61.2, the NativeModules object was empty.

So, after some research, we got the issue: the s.source_files prop had wrong value!

Always take careful to use the right s.source_files podspec prop.

The OP was using: s.source_files = "react-native-paypal-sdk/*.{h,m}"

However, this should be: s.source_files = "ios/**/*.{h,m}"

This is the recommended way for remote repository.

Build failed 'React/RCTBridgeModule.h' file not found

It appeared the problem was the Podfile. It seems that Podfile use its own Podspec which caused troubles. So I simply delete the TouchId pod declaration from my Podfile, clean and re-install my pods.

Then, I manually linked the library to my xcode workspace. To do that, under your project name, Right Click on Libraries directory => Add files to "your project name" => Add the xcodeproj of the npm's package located inside your node_modules directory.

After that, in your project Build Phases under the Link Binary with Libraries you have to add the npm's package static library (example libTouchID.a in my case).

To be sure you can clean your project and try to rebuild, it should work now.

For information, I kept all of my softwares version I mentionned above.

'React/RCTBridgeModule.h' file not found for new Project Configuration in Xcode

The answer can be found on this post : https://stackoverflow.com/a/19729455/12010394

In build settings, you need to "$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)" to Header Search Path and Library Search Path with recursive set to true.

And for maccatalyst, I added a second line to both search paths containing $(BUILD_DIR)/Release-maccatalyst, with recursive option.

(XCode builds the new config in its own folder and looks for dependencies only inside that folder but the dependencies are not built into that same folder).

XCode, please do something, you are really wasting our time !!!

React/RCTBridgeModule.h file not found RNSSplashScreen


$ npm i react-native-splash-screen --save
$ cd ./ios
$ pod update
You don't need to do react-native link on XCode 11 beta + RN >= 0.60
And 'Do Not' add the libSplashScreen.a library to Link Binary With Libraries since this will cause the 'Duplicate Symbol Error'.
And go to AppDelegate.m and import the header as follows
#import <react-native-splash-screen/RNSplashScreen.h>
instead of
#import "RNSplashScreen.h"

Obtained from the following Link

https://github.com/crazycodeboy/react-native-splash-screen/issues/215



Related Topics



Leave a reply



Submit