SolvedCocoaPods Raise default macOS/iOS deployment target
✔️Accepted Answer
The same is happening with iOS btw. Even tho Podfile has info about platform and it's version:
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
use_frameworks!
XCode 12 shows dozens of warnings for every single pod about:
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.
@dnkoutso Is it the same issue, or should I create a new one?
Other Answers:
post_install do |pi|
t = pi.pods_project.targets.find { |t| t.name == 'MyPod' }
t.build_configurations.each do |bc|
bc.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
So to collect what I understand to be happening here:
- A podspec declares the packages minimum platform version for the platforms it supports
- Xcode 12 dropped support for some still-widely-used older platforms by, for example, eliminating support for iOS 8
- We are getting warnings because of the mismatch for pods that support iOS 8 (or other no-longer-supported platforms) trying to compile on Xcode 12.
This might be a naïve suggestion but, could we make the deployment target (for the targets which cocoapods generates for each pod) be set to either the minimum version specified in the podspec or the minimum version specified in the Podfile, whichever is greater?
I have an initial implementation working and hope to have a PR up in a few days.
~/CocoaPods/CocoaPods (1-10-stable) $ git diff
diff --git a/lib/cocoapods/installer/analyzer.rb b/lib/cocoapods/installer/analyzer.rb
index c0cef420b..bdc1329c9 100644
--- a/lib/cocoapods/installer/analyzer.rb
+++ b/lib/cocoapods/installer/analyzer.rb
@@ -860,6 +860,9 @@ module Pod
minimum = Version.new('8.0')
deployment_target = [deployment_target, minimum].max
end
+ deployment_target = [deployment_target, target_definitions.first.platform.deployment_target].max
Platform.new(platform_name, deployment_target)
end
Based on the discussion at #10070, this does not seem to be possible to be fixed in a non-breaking way. Instead, adding a post-install
script to the Podfile
is a better resolution.
For example, here is one for iOS:
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |bc|
bc.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
Report
What did you do?
Built a macOS project that includes pods which do not have the deployment target set for macOS (for example,
Argon2
).What did you expect to happen?
Compile without errors and warnings.
What happened instead?
It seems that starting with Xcode 12, I get a warning when building those pods (I don't get them with Xcode 11):
The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.9 to 10.16.99.
Since 10.6 is ancient, it would be nice to raise the default deployment target for macOS to 10.9 to prevent this warning.