Cocoapods: Podfile without `use_frameworks!` triggers "deployment target" warnings in Xcode 10

Created on 31 Aug 2018  路  29Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

bundle exec pod install

What did you expect to happen?

Install pods correctly, with no warnings in the Xcode project.

What happened instead?

Xcode shows a bunch of warnings when building:

warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'Fabric')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'Crashlytics')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'FSCalendar')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'SwiftTryCatch')
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'Sourcery')
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'OneSignal')
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'SwiftGen')
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'LocalizableCheck')
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'SwiftLint')

These warnings do not appear when using the use_frameworks! flag in the Podfile. It's only when I remove it (and pod install), that I start getting these warnings.

CocoaPods Environment

Stack

   CocoaPods : 1.6.0.beta.1
        Ruby : ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
    RubyGems : 2.6.13
        Host : Mac OS X 10.13.6 (17G65)
       Xcode : 9.4.1 (9F2000)
         Git : git version 2.15.2 (Apple Git-101.1)
Ruby lib dir : /Users/davidjennes/.rbenv/versions/2.4.2/lib
Repositories : bitbucket-appwise-podspecs - [email protected]:appwise/appwise-podspecs.git @ 7695d3238f55b0574fc2fdf6f2e1d324a31a6465
               master - https://github.com/CocoaPods/Specs.git @ d53e8527c3736bf23269687d9a3a6752f84b28f6

Installation Source

Executable Path: /Users/davidjennes/.rbenv/versions/2.4.2/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '10.0'

inhibit_all_warnings!

target 'Student App' do
    project 'Student App',
        'Development - Debug' => :debug,
        'Development - Release' => :release,
        'Staging - Debug' => :debug,
        'Staging - Release' => :release,
        'Production - Debug' => :debug,
        'Production - Release' => :release

    pod 'AppwiseCore'
    pod 'AppwiseCore/CoreData'
    pod 'AppwiseCore/DeepLink'
    pod 'AppwiseCore/UI'

    # Tools
    pod 'LocalizableCheck'
    pod 'Sourcery'
    pod 'SwiftGen'
    pod 'SwiftLint'

    # Other
    pod 'BonMot'
    pod 'CompoundFetchedResultsController'
    pod 'Crashlytics'
    pod 'FetchedDataSource'
    pod 'FSCalendar', :modular_headers => true
    pod 'IQKeyboardManagerSwift'
    pod 'Nuke'
    pod 'Nuke-Alamofire-Plugin'
    pod 'OneSignal'
    pod 'p2.OAuth2'
    pod 'Reusable'
    pod 'SnapKit'

    # Temp fix
    pod 'SwiftTryCatch', :modular_headers => true
end

post_install do | installer |
    require 'fileutils'

    # generate acknowledgements
    FileUtils.cp_r('Pods/Target Support Files/Pods-Student App/Pods-Student App-acknowledgements.plist', 'Application/Resources/Settings.bundle/Acknowledgements.plist', :remove_destination => true)
end

Project that demonstrates the issue

None that I can share.

Note: the only slightly related issue I can find is #6038, but that's for the podspec side, not the Podfile side (I think?).

Most helpful comment

For those wanting a quick fix:

post_install do |installer|
  installer.generated_projects.each do |project|
    project.build_configurations.each do |config|
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
        end
    end
    project.targets.each do |target|
      target.build_configurations.each do |config|
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
        end
      end
    end
  end
end

edit: updated snippet now supports the new generate_multiple_pod_projects option
edit2: Now supports Xcode 11.1

All 29 comments

Note: this issue is also present when using CocoaPods 1.5.3, and with the latest master (e667af1).

@djbe I'd really like a sample here if possible

Is it just using the Podfile above in a sample app? Cause I can get that.

Same example repository as in #8068, different commit:
https://github.com/appwise-labs/AppwiseCore-Example/commit/2f002af0ab0effaf4837603fa27a875463a6647e
You'll probably have to comment out the local development pods.

danke

So far I cant repro

screen shot 2018-08-31 at 11 36 06 am

Xcode 9.4.1

Ah, I'm running Xcode 10 (latest beta). Let me check in Xcode 9.

Yeah, Xcode 9 doesn't trigger the issue. Xcode 10 does.

@djbe i dont think this is a cocoapods issue then. Xcode 10 probably just wants users to move away from iOS 7? :)

The reason it doesnt happen for frameworks is because frameworks need minimum deployment target of 8.0.

https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/installer/analyzer.rb#L731-L734

Deployment target is 7.0 for Crashlytics https://github.com/CocoaPods/Specs/blob/master/Specs/3/6/0/Crashlytics/3.10.7/Crashlytics.podspec.json#L23

CocoaPods honors this. Some other specs do not specify at all therefore we default ot 4.3 (!).

@djbe besides updating the platform defaults to bump them a bit I dont think this is an issue. Authors should bump their podspecs for Xcode 10.

I agree for pods such as Crashlytics, they define 7.0, CocoaPods should respect that.

I disagree though for specs that don't define a deployment target. You'll notice that for most of those in the list, these are warnings for command line tools:

  • SwiftGen
  • Sourcery
  • SwiftLint
  • LocalizableCheck

These specs "support" iOS so that users can add them to their projects, but in no way or form are they "linked" with the user's project. Shouldn't CocoaPods then default to, for example, the user's project deployment target?

The problem is that if the same pod is integrated across multiple targets in the same Podfile with different deployment target versions we do not know which one to pick and have to make an arbitrary choice.

The same problem exists in SWIFT_VERSION build setting. That value is actually derived by the target being integrated unless of course the pod author has specified the swift_version attribute in the DSL. If the pod author does not specify a version and we hit a conflict we error out.

This problem was never an issue until Xcode 10 started to warn about this and it also discusses about the iOS Simulator version.

I am still uncertain there is much for us to do here.

The least we can do is bump the default fallback version.

You're right, multiple targets is an issue.

Bumping the fallback version might be the best option. You could always have this depend on which Xcode version is detected:

  • Xcode 9 --> deployment target 4.3
  • Xcode 10 --> deployment target 8.0

Yeah, I keep being the "bearer of bad news" but I think (and that predates me) CocoaPods have more or less stayed away from knowing the Xcode version to decouple the project from Apple's roadmap which is not really known.

If we start doing this this means each time a new Xcode release is out we would have to make a new release of CocoaPods with this new default deployment target :\

No problem, the same discussion happened with the "multiple swift versions" issue.
Yeah, so the only option then is upping the fallback deployment target to 8.0.

The thing is, this year CocoaPods will need to bump the deployment target to 8.0. Next year it might be 9.0, the year after... So yeah, as much as CocoaPods doesn't want to check Xcode versions, they're pretty much obligated to, in a way? Or release new versions for each new Xcode?

You are more or less correct that this is a fallacy. There is definitely a dependency with Xcode and I think keep it as "soft" as possible is better for the project.

Take this case as an example, the '4.3' _still_ works after all of these years! Yes the warnings are annoying but it hasn't been broken. Keep in mind that the podspecs could also solve this :)

Again, I agree with you that for some podspecs, they should up the deployment target.

But for (most of) the rest, they are command line tools, that have no dependency on iOS, be it 4.3, 8.0, or 13.0 (when we get there). They shouldn't even have a deployment target. Some, like SwiftLint and Sourcery, depend on particular Swift versions (not iOS), but others such as SwiftGen and LocalizableCheck don't even have that requirement.

An option for those tools might be to be able to define, in the podspec, to not have a target at all in the Pods.xcodeproj? Or one step further, do the other libraries such as Crashlytics even need a target? They're precompiled, they only need to be added to the main project/targets with linker flags.

I really don't think pod authors will be releasing new versions just to address this warning, especially older ones that are barely maintained. It would be nice if we could globally override the minimum version in the Podfile.

I'll probably fix it with a post_install hack and will post the snippet here.

For those wanting a quick fix:

post_install do |installer|
  installer.generated_projects.each do |project|
    project.build_configurations.each do |config|
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
        end
    end
    project.targets.each do |target|
      target.build_configurations.each do |config|
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
        end
      end
    end
  end
end

edit: updated snippet now supports the new generate_multiple_pod_projects option
edit2: Now supports Xcode 11.1

Is there a reason if the pod spec doesn't define a deployment target it can't default to the Pods defined value?
I've used the post install hook by @chrisballinger to remove the warnings for now, but I'd like to avoid Podfile hacks where possible.

I use this fix. It respects Podfile platform setting. The idea is simple: set deployment target of the Pods project to all the pods. This should always be correct to my mind.

platform :ios, '9.3'

    post_install do |installer|

    puts 'Determining pod project minimal deployment target'

    pods_project = installer.pods_project
    deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET'
    deployment_targets = pods_project.build_configurations.map{ |config| config.build_settings[deployment_target_key] }
    minimal_deployment_target = deployment_targets.min_by{ |version| Gem::Version.new(version) }

    puts 'Minimal deployment target is ' + minimal_deployment_target
    puts 'Setting each pod deployment target to ' + minimal_deployment_target

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings[deployment_target_key] = minimal_deployment_target
        end
    end
end

Duplicate of #7314

Ich bin derzeit nicht im B眉ro. Ich kehre zur眉ck am 02.01.2019.
Ich werde Ihre Nachricht nach meiner R眉ckkehr beantworten.

Die R眉ckmeldung bezieht sich auf ein Mail mit folgendem Thema:
Re: [CocoaPods/CocoaPods] Podfile without use_frameworks! triggers
"deployment target" warnings in Xcode 10 (#8069)


Gesendet (c) GRZ/RACON Linz 2018 Agent 'Abwesenheit'


Raiffeisen Software GmbH
Firmenbuchnummer: 86804d, Landesgericht Linz
DVR: 0572934, UID: ATU 36961105

Der Austausch von Nachrichten mit dem oben angef眉hrten Absender via E-Mail
dient ausschlie脽lich Informationszwecken. Rechtsgesch盲ftliche Erkl盲rungen
d眉rfen 眉ber dieses Medium nicht ausgetauscht werden.
Correspondence with above mentioned sender via e-mail is only for
information purposes. This medium is not to be used for the exchange of

legally-binding communications.

Closing as dup of #7314

Was this page helpful?
0 / 5 - 0 ratings