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
9 Answers
The issue is related to cocoapods dependency manager. Do the following ot fix this:
- Open the terminal and go to your project ios directory
- Type in
pod init(If it doesn't exist) and thenpod install - Open the workspace project and delete the build from ios folder
- Run
react-native run-iosfrom terminal.
It should work now.
8In 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:
In Xcode, check under Project Navigator:
[Your Project Name] --> Targets --> [Your target name] --> GeneralScroll down to
Frameworks, Libraries and Embedded ContentIf you don't have a
libPods-XXXX.ain there (where XXXX is your project name) then add it:- Click the '+' sign to add the libPods library
- Search for
libPodsin the search box - Choose the
libPods-XXXX.aand clickAdd.
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
In case you have Mac with an Apple M1 chip, It can be resolve in two ways,
#SOLUTION 1
- Open Application->Utilites->Terminal.app
- Right-click, Terminal.app -> Get Info -> General-> Enable "Open using Rosetta"
- Restart Terminal
#SOLUTION 2
- From terminal execute
sudo arch -x86_64 gem install ffi
- Go to iOS directory and execute
1arch -x86_64 pod install
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:
But it's better to use this npm package and follow their instructions:
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.
follow this steps :
Select your project on Xcode
Go to Build Settings
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)
[Mac OSX]
I updated the cocoapods versionbrew upgrade cocoapods
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(), and launch it with Rosetta(Applications -> Right click on 'Iterm2' app -> "Get info" -> Check "Open using Rosetta"). Then run:
sudo gem install cocoapodsrm -rf /Users/{USERNAME}/.cocoapods/repos/cocoapods- Go to your project folder and run
cd ./ios && pod install - Run build with
npx react-native run-ios