fatal error: module map file YogaKit.modulemap not found - ios

I am trying to build an iOS app and get this error. I have the project, target, and podfile all specifying iOS deployment target of 14.2. I am using Xcode V12.2.
fatal error: module map file '/Users/USERNAME/Library/Developer/Xcode/DerivedData/APPNAME-hevjyrbzqmxstztjalctjwmbxffm/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
1 error generated.
When I navigate to that directory I do not see the YogaKit.modulemap file in there. How do I configure the build to copy it to that directory or otherwise fix this error?
I am opening the .xcworkspace project file.
I already did:
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod update
This is an expo ejected bare app using react-native 0.63.3 and cocoapods v1.10.0. I'm building on a Mac Mini M1.
Any help would be greatly appreciated.

In my case, I had opened the file myapp.xcodeproj and tried to build/archive the project. I could not build because the build always failed.
This time I selected File > Open > Selected the ios directory in my project i.e. myapp>packages>myapp>ios . Then, I tried to build the app. This time it worked.
You make sure you open myapp.xcworkspace file instead of .xcodeproj.

Make sure that the iOS deployment target version is equal or higher than the version in the podfile
Pod file target
Xcode deployment target

Try set "Open using Rosetta" open your Xcode
Worked for me

Check your project AND target's 'Build Settings', search with keyword 'valid_archs', if valid_archs config item exists, make sure the value for key DEBUG is 'arm64 armv7 x86_64', in other words, make sure the value contains x86_64.

I managed to resolve the issue in my app.
I had a mismatch between the ios version in Xcode and Podfile.
Podfile
Xcode
I changed my Podfile to platform :ios, '9.0' and ran pod install again.
That did the trick.

I added
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
To my Podfile in the following loop:
post_install do |installer|
end
Like:
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

In my case, I had to do the following, to get the Archive working with XCode 12 in React Native project,
Made sure the same Deployment Target is set correctly across project settings in Xcode and pod file
Turn off optimisation in the release mode by setting Optimisation Level to None (GCC_OPTIMIZATION_LEVEL = 0).
Delete the podfile.lock, and do a fresh pod install.

I solved using the next code in Podfile ..proyect/ios/Podfile
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
#To fix issue _OBJC_CLASS_$_RCTBundleURLProvider
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
# To solve xcode 14 issue not signing some pod projects
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end

Related

iOS: Pod Cache compile error with Swift 5 - Bus error: 10 [duplicate]

I'm using Xcode 10.2, Swift 5.
With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a nonzero exit code.
I've tried delete DerivedData / Clean / pod deintegrate & pod install & pod update. None of these works.
For my project problem was related to pod Cache which gives error when Optimization Level for Release is set to Optimize for Speed [-O]. I have set Compilation Mode to Whole Module again and set optimization level for the pod in pod file:
post_install do |installer|
installer.pods_project.targets.each do |target|
# Cache pod does not accept optimization level '-O', causing Bus 10 error. Use '-Osize' or '-Onone'
if target.name == 'Cache'
target.build_configurations.each do |config|
level = '-Osize'
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = level
puts "Set #{target.name} #{config.name} to Optimization Level #{level}"
end
end
end
end
Refrence: https://github.com/hyperoslo/Cache/issues/233#issuecomment-477749560
I fixed this issue by going Pods Project then to the building settings and setting Compilation Mode to Incremental for Release. Then clean and archive, should compile fine then.
So I had same issue when updating my project to Swift 5.
For some reason, Cocoapods (latest version, 1.6.1) set the SWIFT_VERSION of some pods to Swift 5 even if they're released as Swift 4, 4.1, 4.2 pods.
So I had to add a post install script that set the correction version of swift like so
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'CryptoSwift' || target.name == 'SwiftyBeaver'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
I had the same issue after upgrading to Xcode 10.2. After following the steps below it worked for me:
Update pods
Clean project folder
Change Pods project's Swift Language Version to Unspecified and (as suggested by #Neil Faulkner) Compilation Mode to Incremental
I had to set "Optimization Level" in "Swift Compiler - Code Generation" to "Release" - "No Optimization [-Onone]" from "Optimize for speed" to make Cache pass Archive.
Same with SwiftyBeaver
It seems a problem related to Xcode 10.2. Also other pod projects seems to be fine with Optimization, like Toucan or XCGLogger.
In my case it just appeared probably because I ran project again while it was building.
So what I did was not only clean but also folder clean my project using
SHITF + ALT + COMMAND + K
also I deleted derived data and the project was up and running again.
you can follow this steps...
Make sure to change Swift version to your current version.
Update all your pods.
Clean all derived data of Xcode.
Now Restart your Mac.
You are getting all those error's just because of pods..so either you need to update every pod that you are using.

Xcode 10.2, Swift 5, Command compileSwift failed while build the program with Release Scheme

I'm using Xcode 10.2, Swift 5.
With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a nonzero exit code.
I've tried delete DerivedData / Clean / pod deintegrate & pod install & pod update. None of these works.
For my project problem was related to pod Cache which gives error when Optimization Level for Release is set to Optimize for Speed [-O]. I have set Compilation Mode to Whole Module again and set optimization level for the pod in pod file:
post_install do |installer|
installer.pods_project.targets.each do |target|
# Cache pod does not accept optimization level '-O', causing Bus 10 error. Use '-Osize' or '-Onone'
if target.name == 'Cache'
target.build_configurations.each do |config|
level = '-Osize'
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = level
puts "Set #{target.name} #{config.name} to Optimization Level #{level}"
end
end
end
end
Refrence: https://github.com/hyperoslo/Cache/issues/233#issuecomment-477749560
I fixed this issue by going Pods Project then to the building settings and setting Compilation Mode to Incremental for Release. Then clean and archive, should compile fine then.
So I had same issue when updating my project to Swift 5.
For some reason, Cocoapods (latest version, 1.6.1) set the SWIFT_VERSION of some pods to Swift 5 even if they're released as Swift 4, 4.1, 4.2 pods.
So I had to add a post install script that set the correction version of swift like so
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'CryptoSwift' || target.name == 'SwiftyBeaver'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
end
I had the same issue after upgrading to Xcode 10.2. After following the steps below it worked for me:
Update pods
Clean project folder
Change Pods project's Swift Language Version to Unspecified and (as suggested by #Neil Faulkner) Compilation Mode to Incremental
I had to set "Optimization Level" in "Swift Compiler - Code Generation" to "Release" - "No Optimization [-Onone]" from "Optimize for speed" to make Cache pass Archive.
Same with SwiftyBeaver
It seems a problem related to Xcode 10.2. Also other pod projects seems to be fine with Optimization, like Toucan or XCGLogger.
In my case it just appeared probably because I ran project again while it was building.
So what I did was not only clean but also folder clean my project using
SHITF + ALT + COMMAND + K
also I deleted derived data and the project was up and running again.
you can follow this steps...
Make sure to change Swift version to your current version.
Update all your pods.
Clean all derived data of Xcode.
Now Restart your Mac.
You are getting all those error's just because of pods..so either you need to update every pod that you are using.

The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1

I'm getting this below warning message in my Xcode 10.1.
The iOS Simulator deployment targets are set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1.
My simulator os in 12.1
Xcode 10.1
And I updated my pod file.
My deployment target is 9.0
In my target
You can set up your podfile to automatically match the deployment target of all the podfiles to your current project deployment target like this :
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
The problem is in your pod files deployment target iOS Version not in your project deployment target iOS Version, so you need to change the deployment iOS version for your pods as well to anything higher than 8.0 to do so open your project workspace and do this:
1- Click on pods.
2- Select each project and target and click on build settings.
3- Under Deployment section change the iOS Deployment Target version to anything more than 8.0
(better to try the same project version).
4- Repeat this for every other project in your pods then run the app.
see the photo for details
Instead of specifying a deployment target in pod post install, you can delete the pod deployment target for each pod, which causes the deployment target to be inherited from the Podfile.
You may need to run pod install for the effect to take place.
platform :ios, '12.0'
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
Iterating over the answer from Tao-Nhan Nguyen, accounting the original value set for every pod, adjusting it only if it's not greater than 8.0... Add the following to the Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
end
end
end
end
If anyone came here from react native issue, just delete the /build folder and type react-native run ios
We can apply the project deployment target to all pods target.
Resolved by adding this code block below to end of your Podfile:
post_install do |installer|
fix_deployment_target(installer)
end
def fix_deployment_target(installer)
return if !installer
project = installer.pods_project
project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
puts "Make sure all pods deployment target is #{project_deployment_target.green}"
project.targets.each do |target|
puts " #{target.name}".blue
target.build_configurations.each do |config|
old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
new_target = project_deployment_target
next if old_target == new_target
puts " #{config.name}: #{old_target.yellow} -> #{new_target.green}"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
end
end
end
Results log:
Try these steps:
Delete your Podfile.lock
Delete your Podfile
Build Project
Add initialization code from firebase
cd /ios
pod install
run Project
This was what worked for me.
This solution worked for me for Flutter. open {your_project_root_folder}/ios/Podfile and replace the post_install block with this
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
For Swift
If you are using CocoaPods with Xcode 12, then you have probably seen this error:
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.
This is happening because support for iOS 8 has been dropped, but the minimum deployment target for the pod is iOS 8.
Until this is fixed, you can add the following to your Podfile:
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
This will remove the deployment target from all the pods in your project and allows them to inherit the project/workspace deployment target that has been specified at the top of Podfile.
For React Native
Delete the ./project-root/ios/build folder and type react-native run ios
For Cordova
<preference name="deployment-target" value="8.0" />
If your are come from react-native and facing this error just do this
Open Podfile(your project > ios>Podfile)
comment flipper functions in podfile as below
#use_flipper!
#post_install do |installer|
#flipper_post_install(installer)
#end
In terminal inside IOS folder enter this command pod install
yep, that is it hope it works to you
if anybody is experiencing is issue while updating to the latest react native, try updating your pod file with
use_flipper!
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
All you need to do is just uncomment the following line
# platform :ios, '8.0'
OR
# platform :ios, '9.0'
etc...
and then open iOS folder in the terminal and pass those commands:
% pod repo update
% pod install
I solved this problem, I changed build system to Legacy Build System from New Build System
In Xcode v10+, select File > Project Settings
In previous Xcode, select File > Workspace Settings
Change Build System to Legacy Build System from New Build System --> Click Done.
Simple fix that worked for me in Flutter:
Delete Podfile and Podfile.lock
Run app: This will create a new Podfile. This will probably still fail with an error.
In the new Podfile, uncomment and change the 2nd line to platform :ios, '12.0' (or other min version you want to target)
Run app again, now without errors
For Flutter use this
platform :ios, '10.0'
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Worked for me:
rm ios/Podfile
flutter pub upgrade
flutter pub get
cd ios && pod update
flutter clean && flutter run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
most of the above did not work for me. If you dig around you will see that you aren't supposed to run pod install by hand. What worked for me was making sure my physical device was registered with xcode.
open xcode workspace for ios. select your device (connected via usb most likely) and click Run. This will prompt you to let xcode register your device.
xcode build will most likely fail which is ok - see next steps
Quit Xcode!
cd ios
rm -fR Podfile Podfile.lock Pods
in android studio choose the device in question and c
for cordova developers having this issue
try to set
<preference name="deployment-target" value="8.0" />
in config.xml
This is how I solved this issue with Firebase 10.1 and Xcode 14.1:
Open Xcode
Select Product > Analyze to get all the IPHONEOS_DEPLOYMENT_TARGET warnings
Open Terminal, in your project directory:
pod cache clean --all && pod deintegrate && pod install --repo-update
Check the Xcode again. All the warning should be gone and a single warning from Xcode should be there: "Update to recommended settings"
Click on Perform Changes button
Restart Xcode
There is a detailed discussion about this at the Firebase project repository.
first change the deployment to your choose : like '11.0'
and add this step in the last of your pod file
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
If anyone is getting this problem in 2021 after updating XCode to v13, here's a fix that worked for me:
https://github.com/facebook/react-native/issues/31733#issuecomment-924016466
However, this may not work for all react-native versions, it worked on v0.64 for me.
I used Xcode to create the dummy swift file so I automatically got a request for "Bridging Header"
Hopefully, this would be resolved in a future release.
I had the same issue building my React Native project
cocoapods version update worked for me (upgraded from 1.8.4 to 1.11.2)
Xcode > Runner > Info deployment Target > IOS Deployment Target: 11
.
open terminal :
pod cache clean --all
.
pod update
(flutter)In my case I accidentally imported dart.js so if it was working a moment ago and it just stopped on reload or new restart check your imports
For flutter this is what I'm using inside <project_root>/ios/Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS"] = "armv7"
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
delete pods folder and podfile.lock,increase deployment target in podfile as well as xcode
This is a known issue on M1 MacBooks. Run flutter upgrade and that should fix it.
Currently working on
M1 Mackbook 12.0.0
Flutter 2.10.0
Dart 2.16.0

Flutter - SWIFT_VERSION must be set to a supported value

Trying out the library simple_permission, fixed the pod error and this came up, no idea how to proceed. There's no setting for the swift version in Build Settings, I tried adding it, but it didn't work.
Launching lib/main.dart on iPhone X in debug mode...
Skipping compilation. Fingerprint match.
Running Xcode clean...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET simple_permissions OF PROJECT Pods WITH CONFIGURATION Debug ===
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
Could not build the application for the simulator.
Error launching application on iPhone X.
Check this answer.
When the iOS part of a plugin is coded using Swift, you must make that change to your ios/Podfile. You must add use_frameworks! and config.build_settings['SWIFT_VERSION'] = '4.1'.
target 'Runner' do
use_frameworks! # required by simple_permission
...
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1' # required by simple_permission
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
You might check which SWIFT_VERSION will be required, in that issue, the problem is solved using 3.2. In the answer I posted, 4.1 was recommended but 4.0 also worked.
Fixed by creating an empty swift file in the project.
In the odd case that the other answers do not work for you, use pre_install like:
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
s.swift_version = '4.2' unless s.swift_version
end
end
A combination of the answers above and this answer will definitely sort this out.
Have a look at this issue:
https://github.com/flutter/flutter/issues/16049
It helped me get past this for a project created without swift capability added and then adding on the geolocation plugin.
In this case bridging header must be created.
Open the project with XCode. Then choose File -> New -> File -> Swift File. A dialog will be displayed when creating the swift
file(Since this file is deleted, any name can be used.). XCode will
ask you if you wish to create Bridging Header, click yes. (It's a
major step)
Make sure you have use_frameworks! in the Runner block, in ios/Podfile.
Make sure you have SWIFT_VERSION 4.2 selected in you XCode -> Build Settings
Do flutter clean
Go to your ios folder, delete Podfile.lock and Pods folder and then execute pod install --repo-update
Add this in the file ios/XX.podspec
s.swift_versions = ['4.0', '4.2', '5.0']
this will remove the error.

Pod is built for newer version of

After changing both the deployment target of my project and targets from IOS 10.3 to 9.0 I am receiving the following errors. What am I doing wrong?
edit: These errors only show up when running my code in release not debug
Paste this at the end of your podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
First try cleaning the project (shift+command+K). This likely won’t help but is always worth a try.
If/when cleaning does not work, check that the desired iOS version is in podfile, and then navigate to the project directory in Terminal and run pod update.

Resources