Xcode 12 deployment target warnings when using CocoaPods
Solution 1
A short working solution is here! Just copy and paste the code snippet below at the end of your Podfile and run the pod install command.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
In this case, 12.0 is the minimum supporting iOS version for AppStore submission. You can change it based your project requirements.
Solution 2
This is a problem with the target at your cocoa pods. To me, the answer was to put this code at the end of your pod file:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
end
end
end
It resolved all my problems, compiling and archiving the project.
Another way is just to change the IPHONEOS_DEPLOYMENT_TARGET
in the pods project like described in this image:
Solution 3
Update: To fix this issue you just need to update the Deployment Target
to 9.0
. This can be updated by opening the .xcworkspace
file, choose the Pods.xcodeproj
on Xcode, and updating the iOS Deployment Target
to 9.0
or later as depicted in the below image.
Another easy fix is to add the following to your Podfile
and running pod install
on terminal in the directory.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
Previous: You can't provide support for iOS 8.0
on Xcode 12
unless you import the support files. To provide support by default you would have to use Xcode 11
. It would be better to check for the number of users that use your app on iOS 8
and update the minimum supported version to iOS 9
or higher.
Solution 4
Flutter now requires an additional line for this to work as of late 2021.
Paste the updated code snippet below at the end of your Podfile and run pod install command.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 10.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
end
Note: If you have the below code in your podfile, then replace it with the above code.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Solution 5
This is happening because support for iOS 8 has been dropped in Xcode 12 but the minimum deployment target for the offending pod is still iOS 8. This is documented in the Xcode 12 release notes:
Deprecations
- Xcode now supports debugging apps and running tests on iOS devices running iOS 9.0 and above.
Workaround. You can append the following to your Podfile
as a workaround for now (and then run pod install
as usual):
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
end
This will remove the deployment target settings from all pods using iOS 8 or below, allowing them to simply inherit the project deployment target that you have specified at the top of your Podfile
. For instance:
platform :ios, '10.0'
aturan23
I am a Software Engineer from Kazakhstan, based in Almaty. I have experience in: • Developing both conventional and banking applications from scratch. • Setting up CI/CD environment. • Application optimizations Skills: • Clean Code/Architecture
Updated on July 19, 2022Comments
-
aturan23 almost 2 years
I get this warning on Xcode 12:
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.0.99How to support this version?
-
SoftDesigner over 3 yearsI think only this line is necessary:
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
-
Andres Paladines over 3 yearsThanks @SoftDesigner I will try without it.
-
Michal Šrůtek over 3 yearsI wouldn't recommend changing the settings manually, as the Pods project is auto-generated and whatever you set there will get overridden the next time you call
pod install
orpod update
. -
Sri Harsha Chilakapati about 3 yearsI'm targeting iOS 12, which is what I have in my podfile as well, but I still get these warnings. Is that dropped too?
-
Nicholas Muir almost 3 yearsThis fixes that problem but it causes another error if you are using certain libraries. Flutter/ fatal error: 'Flutter/Flutter.h' file not found when using the current path provider.
-
JDOaktown over 2 yearsIf you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
-
Sandy Garrido over 2 yearsChecking if below 9.0 is exactly what I was after - this has saved me a whole load of time! thanks
-
bm888 over 2 years@NicholasMuir here is the updated code that also solves that second error with the Flutter.h file stackoverflow.com/a/70316588/8094969
-
bm888 over 2 yearsHere is the updated answer for late 2021: stackoverflow.com/a/70316588/8094969
-
nishi about 2 yearshow to do this on EXPO ?
-
Martin Berger almost 2 yearsIf you are using Flutter, you should not have to do Pod install manually, it is done when you build and run the project, at least that is how it is with Android Studio, not sure about VS Code :)