With the latest version of Xcode just released few days ago, we updated to Xcode 12 to verify the project build successfully. One of the changes is the dropped support of iOS 8. This was not directly affecting us, as our minimum deployment target is currently set to iOS 10. This is no problem for us.
But we are using Cocoapods and since Cocoapods has a default minimum deployment target iOS 8, we faced the following 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.0.99.
We checked in the Cocoapods Github project for a solution and until a fix is included as part of it, we decided to use the suggestion of Jesse Squires. But we were still getting the same warning, although less times. Because we were using a newer setting in Cocoapods – generate_multiple_pod_projects like this:
install! 'cocoapods', :generate_multiple_pod_projects => true
there were separate projects for each pod, instead of one big project with all the pods in it.
That’s why instead of deleting the deployment target, we decided to set it explicitly for both the project and the target for every pod:
deployment_target = '10.0'
post_install do |installer|
installer.generated_projects.each do |project|
project.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
end
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
end
end
end
end
This fixed the warning for us.
We also tried completely removing IPHONEOS_DEPLOYMENT_TARGET in the settings, as we have
platform :ios, '10.0'
in the Podfile, but this did not work for us, so for now we will stick with manually setting a deployment target in post_install.