React Native Build Failed On IOS - ios

I am facing the below issue while running the command npx react-native run-ios in my Mac Os Monterey machine. Could anybody please help me with this?
** BUILD FAILED **
The following build commands failed:
CompileC /Users/prashanth/Library/Developer/Xcode/DerivedData/myapp-akpvurjcnemajucrerqjfkzzxnng/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o /Users/prashanth/Documents/REPO/app/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'ReactCommon' from project 'Pods')
(1 failure)
I have the following piece of lines in the Pod file
platform :ios, '9.0'
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
Version of
Node: 15.14.0,
React Native: 0.62.2,
Xcode: 13.4.1
Thank you!

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj
Change all the 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' to 'IPHONEOS_DEPLOYMENT_TARGET = 12.4'. save and run.
Note: every time you pod install, it will change, so you have to do it again. If there is a better approach please do mention it.

Related

Flutter iOS: How to fix "Could not build module `firebase_core`"?

I have a flutter projecct. First it had to work on android and its working! Everything is cool. Time to make it work on iOS but I get the following error when I try to start the project on iOS Simulator:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 13,1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
While building module 'firebase_core' imported from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebaseCorePlugin.h:12:
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
--------------------------------- HERE --------------------------------
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:9: fatal error: could not build module 'firebase_core'
--------------------------------- HERE --------------------------------
#import <firebase_core/FLTFirebasePluginRegistry.h>
~~~~~~~^
2 errors generated.
While building module 'firebase_core' imported from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebaseCorePlugin.h:12:
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
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 'Toast' from project 'Pods')
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 'FMDB' from project 'Pods')
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 'Reachability' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Sadly I did not find any working solution for this...
This is my pubspec.yaml (firebase dependencies):
firebase_performance: ^0.7.0+7
firebase_crashlytics: ^2.1.1
firebase_core: any
firebase_messaging: ^10.0.6
flutter_local_notifications: ^8.1.1+2
Remove ios/Pods folder.
Remove Podfile and Podfile.lock
Remove pubspec.lock
Open terminal and run these commands one after another
pod cache clean -—all
flutter clean
flutter pub get
pod install
this error is coming from .pub-cache so just flutter clean, if the error still persist delete all the .pub-cache then
Remove the package from dependencies in pubspec.yaml, run flutter
packages get. And then add the package to dependencies again and
running flutter packages get.This process has solved the problem for
me in the past.
flutter clean
and pub get
In pubspec.yaml add firebase_core:any . Then run flutter clean , flutter pub get. Then navigate to iOS folder from the project root directory in terminal cd ios. Then run pod install. Now run flutter run and it should work as expected.
What worked for me is using the precompiled version for the Firestore iOS SDK as something went wrong during compilation. See 'Improve iOS Build Times' section at https://firebase.flutter.dev/docs/overview/#initializing-flutterfire
Remove all pod installations that have to do with firebase from your
podfile (e.g. pod 'Firebase/Analytics').
Add the precompiled pod to your podfile (see link above).
I've added pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.7.0' to the runner target in the podfile (this is an older version as the newer also gave some error).
The result looks like this in your podfile:
target 'Runner' do
use_frameworks!
use_modular_headers!
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.7.0'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end```

ld: library not found for -lReactNativePayments

I was upgrading the react native version for my project from 0.59.10 to 0.63.2 and since then I'm facing this issue
ld: library not found for -lReactNativePayments
clang: error: linker command failed with exit code 1 (use -v to see invocation)
when trying to run the project or build it from xcode, I tried almost all solutions I found but nothing changed
my Podfile contains:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
...
pod 'ReactNativePayments', :path => '../node_modules/react-native-payments'
I'm running .xcworkspace and library search paths are empty
any help would be appreciated, thanks in advance

Firebase.h file not found with CocoaPods

I am trying to add Firebase into my project. I just added below pods into my Xcode project.
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Database'
pod 'Firebase/Auth'
After installing podfile, I try to import firebase into my project. But it gives me an error that Firebase.h is not found.
Above issue will occur when I uncheck the Run script only when installing from [CP] Check pods Manifest.lock. After that I will installed pod using pod install. And then issue will occur.
Error which I got after uncheck the checkbox:
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I had the same issues on my project,
I wrote manually link the project and its libraries to solve the problem I followed this link steps it worked
https://github.com/invertase/react-native-firebase-docs/blob/master/docs/installation/ios.md
Also, you must check you link binary with libraries on your Xcode project.
Another solution you can delete all pod depend on libs then you pod init
add manual pod libs after pod install
I am having the same error when I execute, on command line, "cordova build ios --release --device" and I am sure the compilation is using the .xcworkspace file. When I build the project from xCode is working ok.
Cordova version: 8.0.0 and 9.0.0
Ionic: 1.0.0
cordova-android: ^8.1.0
cordova-ios: ^5.1.1
This is the log ...
Checking config.xml for pods.
No new pods detects
Reading build config file: /mobile/build.json
Building project: /mobile/platforms/ios/MyProject.xcworkspace
Configuration: Release
Platform: device
Target:
Adding xcodebuildArg: -UseModernBuildSystem=0
Running command: xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -configuration Release -destination generic/platform=iOS -archivePath MyProject.xcarchive archive CONFIGURATION_BUILD_DIR=/mobile/platforms/ios/build/device SHARED_PRECOMPS_DIR=/mobile/platforms/ios/build/sharedpch -UseModernBuildSystem=0
User defaults from command line:
IDEArchivePathOverride = /mobile/platforms/ios/MyProject.xcarchive
UseModernBuildSystem = 0
Build settings from command line:
CONFIGURATION_BUILD_DIR = /mobile/platforms/ios/build/device
SHARED_PRECOMPS_DIR = /mobile/platforms/ios/build/sharedpch
Prepare build
note: Using legacy build system
...
/mobile/platforms/ios/MyProject/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m:7:9: fatal error:
'Firebase.h' file not found
#import "Firebase.h"
^~~~~~~~~~~~
1 error generated.
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/myUser/Library/Developer/Xcode/DerivedData/MyProject-dwfxupwwzcbssmamqfftsijvblyb/Build/Intermediates.noindex/ArchiveIntermediates/MyProject/IntermediateBuildFilesPath/MyProject.build/Release-iphoneos/MyProject.build/Objects-normal/armv7/FCMPlugin.o MyProject/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
(node:8380) UnhandledPromiseRejectionWarning: Error: xcodebuild: Command failed with exit code 65
at ChildProcess.whenDone (/mobile/node_modules/cordova-common/src/superspawn.js:135:23)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:984:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
(node:8380) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8380) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error: unable to spawn process (Argument list too long) Xcode 10.1

Error Log:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/../Script-A..B8.sh (in target: C..r)
cd /Projects/...
/bin/sh -c /Users/../Script-A..B8.sh
error: unable to spawn process (Argument list too long)**
I am getting this error while creating an Archive from Xcode (10.1). My build succeeds. I encountered this error after installing below mentioned pods,
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
My Xcode project is a multi target and multi configuration project managed using xconfig file.
I tried disintegrating, installing, updating pod again and again, but no luck.
Enable Legacy System for workspace setting

ld: library not found for -lDoubleConversion React Native 0.59

I have this error
❌ ld: library not found for -lDoubleConversion
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening App.xcworkspace
** BUILD FAILED **
The following build commands failed:
Ld /Users/mohamedelmi/workspace/elmi/food-frontend/ios/build/App/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/x86_64/App normal x86_64
(1 failure)
here is what i did
I clean and rebuild still have the error
rm -f ~/Library/Developer/Xcode/DerivedData/ModuleCach
First of all, make sure that Libraries -> React.xcodeproj -> ThirdParty -> double-conversion exists and a static library is being produced from it, like this:
Then, if are you're using cocoapods, make sure to add DoubleConversion to your Podfile:
target 'MyApp' do
pod 'React', :path => "../node_modules/react-native", :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
# the following ones are the ones taken from "Libraries" in Xcode:
'RCTAnimation',
'RCTActionSheet',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'yoga', :path => "../node_modules/react-native/ReactCommon/yoga"
# Here it goes
pod 'DoubleConversion', :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec"
pod 'Folly', :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec"
end
And finally, if none of this worked so far, there's a script you can manually run
in order to resolve React's third-party dependencies.
Just go to node_modules/react-native and type:
$ ./scripts/ios-install-third-party.sh
Important: Always run it inside node_modules/react-native. Because, as far as I know, the script uses relative paths in order to store third-party's source code and react native will always look for it at node_modules/react-native/third-party. So just make sure to run it in the right place.
Note: This script is, probably, already running as a build phase on your project.
I followed the answers on Why linker link static libraries with errors? iOS but nothing worked for me since I was combining the answers.
I got it to work by ONLY doing the "create new Swift-file"-trick. So remove everything, do a fresh install and only add a new Swift-file that will create the Bridging Header (dont delete the Swift-file).
This is what finally worked for me.
pod deintegrate
pod install
Open project in X-Code
Remove Resources folder from left sidebar
Build your project from New Build System.
This is what finally worked for me. (Before proceeding, make sure pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' is included in your podfiles
1. cd ios
2. Delete Podfile.lock
3. pod deintegrate
4. pod install
5. cd ..
6. rm -rf node_modules && yarn
7. Add use_frameworks! to your Podfile
Run react-native-run-ios or Build with Xcode by opening the xcworkspace file in your ios directory.

Resources