'React/RCTBridgeDelegate.h' file not found

I have created a new project called auth using react-native init auth at terminal.When i tried to run the project using react-native run-ios. The build failed and gave a error 'React/RCTBridgeDelegate.h' file not found.

Tried to update the react native version

react-native run-ios at terminal in mac

I expect the build to be successful and see the ios simulator The actual result which i got is build failed and hence cant see the simulator



Solution 1:[1]

In my case the libPods-FOO.a library had somehow become unlinked when I did a pod update && pod install. To see if this applies to you:

  1. In Xcode, check under Project Navigator:

    [Your Project Name] --> Targets --> [Your target name] --> General
    
  2. Scroll down to Frameworks, Libraries and Embedded Content

  3. If you don't have a libPods-XXXX.a in there (where XXXX is your project name) then add it:

    1. Click the '+' sign to add the libPods library
    2. Search for libPods in the search box
    3. Choose the libPods-XXXX.a and click Add.

Add library

libPods.....a

Solution 2:[2]

Just a hint: for those of you using the M1 Macs, pod install won't work. You should use arch -x86_64 pod install as stated in this issue

Solution 3:[3]

In case you have Mac with an Apple M1 chip, It can be resolve in two ways,

#SOLUTION 1

  1. Open Application->Utilites->Terminal.app
  2. Right-click, Terminal.app -> Get Info -> General-> Enable "Open using Rosetta"
  3. Restart Terminal

enter image description here

#SOLUTION 2

  1. From terminal execute

sudo arch -x86_64 gem install ffi

  1. Go to iOS directory and execute

arch -x86_64 pod install

Solution 4:[4]

I did what @Vahid suggested, but I also had another issue. A set of instructions I was following told me to pull the related .xcodeproj file into my actual project and then manually link a few different files.

These steps were not necessary and were creating the issue for me.

I was following this: https://github.com/frostney/react-native-ibeacon

But it's better to use this npm package and follow their instructions: https://www.npmjs.com/package/react-native-ibeacons

Solution 5:[5]

In this particular project, certain targets were not working. I noticed the broken targets with this error were missing libPods-myProjectName.a. Under Targets -> General tab, "Frameworks, Libraries and Embedded Content" I pressed the "+" icon and searched for "pods" and added "pods-myProjectName.a" and now it seems to work. This might not be applicable to you, but I am adding this as another possibility of what might be wrong.

Solution 6:[6]

follow this steps :

  1. Select your project on Xcode

  2. Go to Build Settings

  3. In Search path tab select Header Search Path and add this values for both debug and release

    $(inherited)

    ${PODS_ROOT}

    ${SRCROOT}/../../../ios/Pods/Headers (Make sure to set it to recursive)

enter image description here

Solution 7:[7]

[Mac OSX] I updated the cocoapods version brew upgrade cocoapods

Solution 8:[8]

It can happen if you are using mac on M1 chip and trying to run the app on a simulator. Try to install iterm2 from official site(https://iterm2.com/), and launch it with Rosetta(Applications -> Right click on 'Iterm2' app -> "Get info" -> Check "Open using Rosetta"). Then run:

  1. sudo gem install cocoapods
  2. rm -rf /Users/{USERNAME}/.cocoapods/repos/cocoapods
  3. Go to your project folder and run cd ./ios && pod install
  4. Run build with npx react-native run-ios

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cobberboy
Solution 2 Marco Galindo
Solution 3
Solution 4 a_lovelace
Solution 5 Karatekid430
Solution 6 abdelhedi hlel
Solution 7 Laurent
Solution 8 Kirill Kohan