React-Native IOS build giving error on pod install.? - ios

Iam new to learning react-native and i want o generate an ios build but it keeps giving me this error whenever i try i run pod install. Iam unable to figure it out where iam wrong i have tried several options but it didnt work. If anyone can tell me where the problem is it would be a great help.
EOF
# Prepare exported header include
EXPORTED_INCLUDE_DIR="exported/glog"
mkdir -p exported/glog
cp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
/Users/shehzad/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option
Try `/Users/shehzad/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/shehzad/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6':
configure: error: C compiler cannot create executables
See `config.log' for more details
[!] `xcodeproj` was renamed to `project`. Please update your Podfile accordingly.
[!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `DC1D7AC84A2642079DCCD9FF` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
my pod file
here is my ios project structure

comment out flipper command block if you are not using it.
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'
target 'studypal' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'studypalTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
end
target 'studypal-tvOS' do
# Pods for RnDiffApp-tvOS
target 'studypal-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
then try running pod install again
cd ios
pod install
this works for me everytime

Seems like you add xcodeproj property and that is causing the crash. Just rid that line.
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'
target 'studypal' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'studypalTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'studypal-tvOS' do
# Pods for RnDiffApp-tvOS
target 'studypal-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end

Related

Problem archiving project to create XcFramework

** I am running following command to create archive. **
`
xcodebuild archive \
-scheme ScannerV1 \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-archivePath './build/ScannerV1.framework-iphonesimulator.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
`
This is my pod file
`
target 'ScannerV1' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for ScannerV1
pod 'IQKeyboardManagerSwift'
pod 'ProgressHUD'
pod 'GoogleMLKit/FaceDetection'
pod 'GoogleMLKit/BarcodeScanning'
pod 'GoogleMLKit/TextRecognition','2.2.0'
pod 'Alamofire'
# pod 'SwiftKeychainWrapper'
end
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
`
**This is the error I am getting . **
SwiftEmitModule normal x86_64 Emitting\ module\ for\ ScannerV1 (in target 'ScannerV1' from project 'ScannerV1') (1 failure)
Also as you can see I have commented SwiftKeychainWrapper pod . This is because I was getting error that SwiftKeychainWrapper is not found / No such module SwiftKeychainWrapper .
Now I got an error and that is : error: no such module 'Alamofire'
I mentioned above what I tried . I am expecting to create archive when creating xcframework

React-Native: Could not build module 'Darwin' after upgrading react & react-native

After upgrading react-native package from 0.63.4 to 0.64.4 I got following errors in Xcode (on MacBook Pro M1) while building and running the app on simulator and device:
I tried to it with and without using flipper, but nothing helped.
Also added CoreFoundation and Foundation Framework manually to the project and ran Xcode with and without Rosetta enabled.
This is my current PodFile:
source 'https://github.com/CocoaPods/Specs.git'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.0'
target 'MyApp' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'react-native-netinfo', :path => '../node_modules/#react-native-community/netinfo'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
My working solution for this is to create a new, clean project with the version you want to upgrade to.
Afterwards do following steps:
Open both .xcworkspace files in Xcode
Head over to your Targets Build Settings
Search for "Header Search Paths"
Copy all Header Search Paths from new Project to your project you want to upgrade
Remove DerivedData, Clean Build and Run again
Run pod install. Maybe you need to upgrade some packages
Additionally a nice npm script for rebuilding .xcworkspace (Replace "[PRJECT_NAME]" with your .xcworkspace name):
"renew-pods-m1": "cd ios; rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf [PROJECT_NAME].xcworkspace; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; arch -x86_64 pod install;"
Note: Have a look at your PodFile. Maybe you need to change the use_react_native implementation and add the post_install script
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
At the end of the PodFile
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
For me it was Flipper. I wasn't using it in my old project, and it was automatically enabled in my new one. Just comment out the line in your Podfile if your project doesn't require it.
# :flipper_configuration => FlipperConfiguration.enabled,

ld: library not found for -lReact-RCTVibration

I am able to build and run the app in a simulator. However, whenever I want to archive it (selecting any ios devices) to release the app into the AppStore, I am getting this error.
ld: warning: directory not found for option '-L/Users/bigyankarki/Library/Developer/Xcode/DerivedData/Neex-dnesybikpygafkfxhimxsgrjawis/Build/Intermediates.noindex/ArchiveIntermediates/Neex/BuildProductsPath/Release-iphoneos/React-RCTVibration'
ld: warning: directory not found for option '-L/Users/bigyankarki/Library/Developer/Xcode/DerivedData/Neex-dnesybikpygafkfxhimxsgrjawis/Build/Intermediates.noindex/ArchiveIntermediates/Neex/BuildProductsPath/Release-iphoneos/react-native-safe-area-context'
ld: library not found for -lReact-RCTVibration
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have followed this, and other multiple solutions with the same library not found error, but to no avail. I even included it to podfile,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
target 'Neex' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'RNCAsyncStorage', :path => '../node_modules/#react-native-async-storage/async-storage'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
target 'NeexTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
and even linked it in buildphase, but none works.
I solved the problem by setting 'Build setting architectures only' to Yes for both release and debug. After that, the problem seems to be resolved and I was able to archive the app.

React Native builds work in simulators but not on ios device?

I have my build working fine on ios simulators, but when I plug in my iphone and run react-native run-ios --device "Max’s Iphone 12 Mini", the build fails. Error Below from rn cli below.
The following build commands failed:
Ld /Users/maxmandia/Library/Developer/Xcode/DerivedData/musicplace_ios-aaznfqkkkkeeldftonqjsqawrhgr/Build/Products/Debug-iphoneos/RCT-Folly/folly.framework/folly normal (in target 'RCT-Folly' from project 'Pods')
When I try to run the app in xcode, I get another error:
ld: -U and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
Here is my pod file
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
target 'musicplace_ios' do
use_frameworks!
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'musicplace_iosTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
Any help would be great! I tried disabling bitcode and it still showed ENABLE_BITCODE=YES in the error message - cleaned my build folder too. Really out of idea right now.

Pods errors on xcode project

I am trying to update my xCode project with latest libraries, but I have errors building my project. Here are the details:
xcode 13.4.1
Cocoapods 1.11.3
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'la soundbox' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'FirebaseCore'
pod 'FirebaseFirestore'
pod 'FirebaseAuth'
pod 'FirebaseMessaging'
pod 'FirebaseInAppMessaging'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'
pod 'FirebaseRemoteConfig'
pod 'Google-Mobile-Ads-SDK'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Before installing anything, here is what I do:
Clear Build folder
Exit xCode
Run those commands
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf /path_to_project/Pods
rm /path_to_project/Podfile.lock
Restart mac
Launch xCode and build project
I have this error that keeps coming up (From FirebaseInAppMessaging pod, in FIRInAppMessaging.m):
'FirebaseCore/FIRAppInternal.h' file not found
Did not find header 'FIRAppInternal.h' in framework 'FirebaseCore'
What could be done to avoid this error ? I'm struggling on this and I really don't know what can I can do anymore

Resources