React/RCTBridgeDelegate.h' file not found
Asked Answered
E

16

48

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

Exsanguinate answered 6/7, 2019 at 18:49 Comment(0)
F
68

The issue is related to cocoapods dependency manager. Do the following to fix this:

  1. Open the terminal and go to your project ios directory
  2. Type in pod init (If it doesn't exist) and then pod install
  3. Open the workspace project and delete the build from ios folder
  4. Run react-native run-ios from terminal.

It should work now.

Fenestrated answered 7/7, 2019 at 5:39 Comment(9)
There is already podfile existing.when i try to run pod init, it says /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directoryExsanguinate
if already exist ignore pod init and just type "pod install" and it will take time to be finished, please don't forget to delete the build file from ios folder and then type react-native run-iosFenestrated
did you type "pod install" ? It will overwrite the current oneFenestrated
@Fenestrated I have removed build folder and run pod install and try to build app. But it failed with the same error React/RCTBridgeDelegate.h' file not found in AppDelegate.h fileJordonjorey
@Jordonjorey I have same issue, have you found any solution?Hugo
When I tried pod install I received that: [!] Invalid Podfile` file: cannot load such file -- /Users/rafael/workspace/everest-client-app/node_modules/@react-native-community/cli-platform-ios/native_modules.`Vicentevicepresident
does not work at all, just tried on a fresh react-native project to add @react-navigation/native @react-navigation/native-stack non of the steps do helpCutler
In the ios dir, running pod deintegrate && pod setup && pod install (using Rosetta-mode iTerm2 for M1) usually fixes pod issues for me. This time, it did not.Munition
I our case we've get same error in two Macs with M1 cpu, and the solution to run the App was through Xcode going to Product, Destination, Destination Architecture and choose Show Rosetta destination. After that, the error stay but the App start running in emulator.Nolin
W
14

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

Wadding answered 18/2, 2021 at 10:0 Comment(4)
not getting this file, libPods-zzz.a ,any help?Gastrotrich
@GaneshGodshelwar check for Pods-zzz.aPresto
solved by adding this lines in podfile, as we were using env dev and pro abstract_target 'KidsCommonPods' do # <- Add this # React Native Maps dependencies target 'KidsDev' do end target 'KidsPro' do endGastrotrich
I'm also facing this issue and not getting this file. @GaneshGodshelwar could u explain more about to solve the problem by adding code in podfile?Rotogravure
R
8

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

Rai answered 4/12, 2021 at 17:59 Comment(1)
My understanding is if you set your terminal app to use Rosetta mode, then arch is not needed.Munition
G
8

The issue happened due to the missing of React schema in cocoapods dependency. to resolve follow these steps:

  1. open project in XCode using ios/{project name}.xcworkspace file

  2. From menu bar -> click Product-> Scheme -> Manage Scheme

  3. It will open a modal -> click on the + button

  4. List item

  5. New modal -> In target DropDown select React and click okay

  6. close the modal and rebuild project Project - Build

it will resolve the issue.

Griefstricken answered 1/9, 2022 at 6:37 Comment(5)
This worked for me. I also had an invalid import on <FirebaseCore/FirebaseCore.h> and this solved the issue on M1 mac. Thank you!Rosiorosita
Thank you . This solved the a lot of issueSprawl
I don't see React in the dropdown menuChemo
I dont see React in Drop Down MenuLimp
it worked for me using react native 0;70.6Rompish
C
6

In my Xcode project I had to have multiple targets.

enter image description here

I added the (dev) target for development purposes, but in order to add React Native to that target you have to add it to the Podfile.

target 'MyApp' do
  config = use_native_modules!

...

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # 👇 Add your target in the Podfile
  target 'MyApp (dev)' do
    inherit! :complete
  end

...

Then run pod install inside your ios folder, and done!

My setup:

react-native 0.70, macOS Monterey, MacBook Pro M1 2021

Crepe answered 24/1, 2023 at 14:10 Comment(1)
I didn't know if it need to be inside the "parent" target, I put it below previously!Dill
M
5

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

Memory answered 17/1, 2022 at 10:5 Comment(1)
In my case, this did not resolve the issue. I set both Xcode 13.3 and terminal to Rosetta mode. Xcode build fails regardless. I'm not 100% sure, yet, if my issue relates to this. Something else could be breaking that makes this error appear. Still investigating.Munition
V
3

To those who are facing, make sure

  target 'runner' do
    inherit! :complete
    # Pods for production
  end
  target 'runnerDev' do
    inherit! :complete
    # Pods for development
  end

this is present for every flavor in Podfile

Vervain answered 20/4, 2023 at 11:34 Comment(0)
S
2

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

Sandman answered 13/1, 2021 at 17:45 Comment(0)
O
1

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

Outbreed answered 27/4, 2021 at 11:30 Comment(2)
Thank you ! I switched from intel to M2 and my build was failing because the Header Search Path was emptyFoil
Edit: Don't use recursive as it may cause other build issues, see: #75930823Foil
D
1

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.

Dorolice answered 29/12, 2021 at 4:20 Comment(0)
C
1

The simple pod install command did not work for me. If you have M1 Mac then try using.

arch -x86_64 pod install 
Chirography answered 3/9, 2022 at 22:6 Comment(0)
P
1

For me adding arm64 to Excluded Architectures section works.

enter image description here

Poky answered 8/10, 2022 at 19:5 Comment(1)
This is the only thing that worked for me after hours of searching.....why does this work?Bersagliere
E
1

if you are running the App in either M2 or M1 then you need to enable rosetta destination in xcode for your simulator. You can enable this from product -> Destination -> Destination Architecture -> show rosetta Architechture

Evelunn answered 22/2 at 10:10 Comment(0)
J
0

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

Jarv answered 26/5, 2021 at 19:24 Comment(0)
K
0

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
Kaka answered 27/7, 2021 at 10:14 Comment(0)
A
0

I faced same issue here and I fixed it just running sudo gem uninstall cocoapods or you can just run brew upgrade cocoapods on macbook air M1. if cocoapods not is installed just install it running sudo gem install cocoapods.

Amaryllidaceous answered 5/1 at 12:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.