react-native run-ios fails to build - xcode

I have an existing project, that have been tested on an windows + android setup. Now I'm trying to run it on a macbook to test on an Iphone 11 simulator.
react-native-cli: 2.0.1
react-native: 0.64.0
I install the pod file and try to run
react-native run-ios
I get a the following error:
** BUILD FAILED **
The following build commands failed:
CompileC [USER]/Library/Developer/Xcode/DerivedData/andon-hkuetryxdipcrgbcxnseaqnfnaqp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o [PROJECT_PATH]/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

I encountered this problem while running a React Native iOS app on macOS. After researching the issue for hours I was able to resolve it with these steps:
Clear the cache of pod by running these commands:
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
Navigate to the ios directory, and delete the Pods directory
While still in the ios directory, run pod install
Navigate back to the project directory, and run npx react-native run-ios
Hope this helps you too!

Probably very late to answer.
I started facing this issue after I upgraded from 0.63.4 to 0.64.2.
If we run from command line was not getting any way to find out the error. When I ran from x-code, found following error message,
/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm:172:8: 'shared_timed_mutex' is unavailable: introduced in iOS 10.0
The reason for that was the following entry in my podfile,
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
After I deleted the above entry it started working like a charm.
ref: https://github.com/facebook/react-native/issues/31250#issuecomment-808312355

Under XCode top menu, Goto XCode->Preferences -> Locations -> Open
Derived Data folder(By clicking the arrow button) (Find screenshot
for your references)
Finder will open Derived Data folder,
Delete Derived Data Folder
Start Metro server using npm start or yarn start
Perform Clean build using cmd+shift+k
Run the application using cmd+r

Related

xCode build failed: Module 'connectivity_plus' not found

I am developing a flutter app and running on iOS Simulator works fine in Android Studio, and it works well when building from terminal flutter build ios. But when I try to build from xCode (so I can create an archive and release the app), I get this error:
Module 'connectivity_plus' not found
I used to use connectivity, and then the error was Module 'connectivity' not found.
I have found some similar questions, but none of the suggested answers worked for me. I have tried:
flutter clean
rm -rf /ios/Pods
rm -rf /ios/Podfile
rm -rf /ios/Podfile.lock
flutter pub get
cd ios
pod install
I uncomment this line in Podfile:
platform :ios, '13.0'
That is the iOS Deployment Target as well, so they match.
flutter build ios
That works ok, but when I open Runner.xcworkspace in xCode and build, I get the same error. What am I doing wrong?

XCode 14.0.1 error build: Command PhaseScriptExecution failed with a nonzero exit code (React Native project)

I'm trying to run my React Native project on XCode so that I can get it to run on my iOS device, everything works perfectly fine in VS Code and the Simulator software, but XCode simply refuses to build the project, throwing the error:
error build: Command PhaseScriptExecution failed with a nonzero exit code
This error occurs even when I try running an untouched new project (the example init project from react-native).
I tried these solutions:
deintegrating and reinstalling pods
running this command: npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle
Locking and unlocking the "login" keychain, I wasn't able to lock the keychain in the first place, the option is greyed out. What could cause that?
run pod install in the ios directory
I use:
XCode 14.0.1
M1 Macbook Air
MacOS Big Sur 12.6
React Native 9.1.3 (at least that's what npx react-native -v says, but node modules -> react-native -> package.json in my project says it's 0.70.1)
If there are any more details you need please let me know, thanks.
EDIT: Here's a screenshot of the build's report in the report navigator
screenshot

project run in iOS simulator, but did not build project in react native

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'Flipper' from project 'Pods')
** BUILD FAILED **
The following build commands failed:
Ld /Users/ramprasadsarkar/Library/Developer/Xcode/DerivedData/AwesomeProject-edxfscsdfjwsmicnfanfokvrokke/Build/Intermediates.noindex/AwesomeProject.build/Release-iphonesimulator/AwesomeProject.build/Objects-normal/arm64/Binary/AwesomeProject normal arm64
Please try the following.
If you are using terminal then set directory to your app folder.
or if you are using Vscode just open the terminal.
I hope you have already installed node.(did basic setup).
In terminal add follwing commands one by one, means use next commands only after completing 1 st command run.
npm install
cd ios
pod install
cd ..
npm run ios or npx react-native run-ios
Just check it works.

Xcode cordova project - pods

I have built and published a cordova app with android on my windows PC.
I have copied entire cordova project to a usb drive and transferred the project to a Mac to publish the iOS version.
I can navigate to the platforms/ios directory and open the xcode workspace file. When I try to build the project for the emulator I get the message:
pods-debug.xcconfig:2:could not find included file 'Pods/Target Support Files/' then the reference is to my windows files: C:\path\platforms\ios...
I have tried to deintegrate and reinstall pods through the terminal, and I can remove them and but i get a message saying that 'the workspace referencing the Pods project still remain'
and the problem with building persists.
I suspect that I need to try and rebuild the pods in Xcode but I do not know how.
To fix this, I had to reinstall cordova. using the command line I changed all permissions to allow me to update the $PATH so that cordova commands on the mac could be used.
Then I had to remove platform iOS and re-add it
The I had to go into into platform/ios and run these commands:
pod deintegrate
pod install
After that I could enter xcode by clicking on the workspace and I could perform a test build

Detached react-native expo project, "config.h" not found xcode project

I have problem resolving issue "config.h not found" when running .xcworkspace project after pods are installed.
I ejected from expo using npm run eject
Then I ran pod install inside ios dictionary
Can not build the project due to mentioned error. Already tried all the tips mentioned in forums.
Screenshot from xcode

Resources