-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise default macOS/iOS deployment target #9884
Comments
Yeap a PR would be nice and easy for this! |
Alright, will do in the next days. |
The same is happening with iOS btw. Even tho Podfile has info about platform and it's version:
XCode 12 shows dozens of warnings for every single pod about: @dnkoutso Is it the same issue, or should I create a new one? |
See related Swift Package Manager issue discussion at https://forums.swift.org/t/minimum-ios-version-xcode-12-and-build-warnings/40224 |
So to collect what I understand to be happening here:
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? |
(Since the only alternative appears for the community to make many PRs to many pods to individually raise each of their minimum versions to iOS 9, which seems impractical.) |
I have an initial implementation working and hope to have a PR up in a few days.
|
Based on the discussion at #10070, this does not seem to be possible to be fixed in a non-breaking way. Instead, adding a For example, here is one for iOS:
|
I would also recommend filing issues to pod authors to bump the deployment target in their podspecs. |
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 |
I think I am going to close this. While CocoaPods does not offer a "first-class" API to override values it can do it via a In the meantime I still recommend folks to update their podspecs and specify their deployment target to begin with or update them to bump them from 8.0. |
Still open to suggestions and discussions here, I will re-open this if needed. |
Developing on a long-term project I am facing many of these warnings on the different cocoa pods.
|
This solution is working for my needs
|
Why doesn't specifying the platform in the Podfile (eg |
The pod may be using macOS APIs deprecated or even deleted in 11.0 . Only the pod provider can reliably determine the correct minimum OS version in the podspec. |
My Podfile:
after run cordova build ios --release see in build log:
@tbechtum how to fix that? |
(P.S. Implementation questions are usually best answered on StackOverflow - it's more set up for questions like this than Github Issues are...) |
When setting IPHONEOS_DEPLOYMENT_TARGET to 11 in post install , there is build error for material components library. https://github.com/material-components/material-components-ios/issues/10071
This library by google is quite popular so well I believe this is or eventually could affect a lot of users. So here in that bug report someone say you should not set in post install IPHONEOS_DEPLOYMENT_TARGET . He say it should be fixed by cocoapods (he is just some developer not google contributor looks like so doesn't matter probably) , so its little back and forth with this deployment target thing... I am dealing with this repeatedly for some year or so... I used this:
Now I am switching back to this hopefully I am free of issues for at last one year...
|
This post_install solution is only a workaround because this does not include that the source code of the pod project compiles successfully against the SDK of the desired deployment target. While we are talking about new developments I think it is fair enough to de-support the iOS 8 platform. May be you will not loose a lot of clients while there are not a lot of apps supporting still iOS 8. |
Do you have statistics how many active projects are still supporting iOS 8? Thanks. |
Hi everyone, I've been reading everything you posted. I'm getting the same error but the thing is when I add this: post_install do |installer| And then try to run pod install this is what I'm getting: -bash: /usr/local/bin/pod: /Applications/MAMP/Library/bin/ruby: bad interpreter: No such file or directory What can I do to fix this? |
@nicolekapp Searching Stack Overflow says the bash error you're getting is complaining that ruby can't read the pod binary. I'm gonna guess that's because you're using the copy of ruby in the MAMP Application rather than one properly installed in the CLI (the system's built-in one or one from Once you have ruby working, do let us know if that |
I think this hook covers it all and actually mimics the behavior I would have expected from CocoaPods: post_install do |installer|
# Fix deployment target for pods that don't specify one
# or specify one that is older than our own deployment target.
desired_ios = Gem::Version.new(DEPLOYMENT_TARGET_IOS)
desired_macos = Gem::Version.new(DEPLOYMENT_TARGET_MACOS)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
settings = config.build_settings
actual = Gem::Version.new(settings['IPHONEOS_DEPLOYMENT_TARGET'])
if actual < desired_ios
settings['IPHONEOS_DEPLOYMENT_TARGET'] = DEPLOYMENT_TARGET_IOS
end
actual = Gem::Version.new(settings['MACOSX_DEPLOYMENT_TARGET'])
if actual < desired_macos
settings['MACOSX_DEPLOYMENT_TARGET'] = DEPLOYMENT_TARGET_MACOS
end
end
end
end The important part here is that in case a pod has set a target and this target is newer than our own target, of course we must keep the target of the pod and not override it with a lower one as that cannot ever work. Raising the target is usually safe, unless the pod cannot be build for that target anymore but then it will noticeably fail to build and would have probably failed without that hook to begin with. |
Note that the hook in the comment above will cause extra warnings in code that is written to support the |
@paulb777 That is a problem Firebase needs to address and unrelated to this issue. Setting a lower deployment target doesn't change the fact that your code uses deprecated API and lives on borrowed time, it just suppresses the warning but once Apple removes that API altogether, the code will fail to compile for newer OS releases and no set deployment target will prevent that from happening. The correct behavior is not not access deprecated API unless you know you are running on a system where it wasn't deprecated (e.g. by using |
@CodingMarkus No argument that the SDKs need to address. And they will have to before the APIs actually go away. However, it would add a lot of extra testing and clutter for every SDK to test for each iOS version they support as a minimum before they actually stop supporting the absolute minimum. |
@CodingMarkus are DEPLOYMENT_TARGET_IOS and DEPLOYMENT_TARGET_MACOS meant to represent variables? In other words, should I replace those with, say, '11.0' and '12.1' or similar? Or just cut-and-paste your hook as-is? Sorry if this is a stupid question, but I'm new at this and just trying to figure out why my app that ran fine yesterday suddenly won't compile... |
You can copy the hook as is, you just somewhere have to define them above the hook, e.g.
We define them at the very top of our Podifle, that way we can also use them elsewhere in our Podfile, e.g.
And if we ever have to alter the deployment target of either platform, we only have to change that in on place at the very top of our Podfile, after all our Podfile lists 15 targets at the moment. Having to only change the target in just one central place makes it way easier, just like placing pods shared between targets into own defines as also shown above.
Stupid would only be to waste plenty of time with trial and error because one is afraid to ask. If you get no reply or just a negative one, the later one is still an option but it should never be the first option to target. |
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.
The text was updated successfully, but these errors were encountered: