Skip to content

pods are always installed for iOS 8 deployment target instead of iOS 9 #7314

Closed

Description

@Coeur

Report

What did you do?

  1. Create a new Xcode 9.2 project "example" for iOS Swift
  2. Change deployment target to iOS 9.0
  3. Use a Podfile with:
platform :ios, '9.0'
use_frameworks!

abstract_target 'default_pods' do
    pod 'AFNetworking', '~> 3'
    target 'example'
end
  1. Run pod install or pod update

What did you expect to happen?

AFNetworking is installed with a Deployment Target of iOS 9.0.

What happened instead?

AFNetworking is installed with a Deployment Target of iOS 8.0, which causes noticeable warnings like /Users/coeur/example/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:163:30: 'setResumingHandler:' is only available on iOS 9.0 or newer

Even if I manually change the Pods project Deployment Target to iOS 9.0, a simple pod update will reset it to iOS 8.0.

CocoaPods Environment

  • CocoaPods 1.4.0.rc.1 (also reproduced with CocoaPods 1.3.1)
  • Xcode 9.2 & High Sierra

Project that demonstrates the issue

https://github.com/Coeur/CocoaPods7314

Activity

  1. Coeur commented on Jan 8, 2018

    @Coeur
    ContributorAuthor

    I found the following workaround, adding a post_install hook:

    platform :ios, '9.0'
    use_frameworks!
    
    abstract_target 'default_pods' do
        pod 'AFNetworking', '~> 3'
        target 'example'
    end
    
    post_install do |pi|
        pi.pods_project.targets.each do |t|
            t.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
            end
        end
    end
    
  2. dnkoutso commented on Jan 8, 2018

    @dnkoutso
    Contributor

    Can you please provide a sample project and use the template given to you when you file a new issue?

  3. Coeur commented on Jan 9, 2018

    @Coeur
    ContributorAuthor

    @dnkoutso Done, with a screenshot.

  4. dnkoutso commented on Jan 9, 2018

    @dnkoutso
    Contributor

    @Coeur still dont think its a CocoaPods bug. The podspec of AFNetworking sets deployment target to 7.0 but I think because you are using Xcode 9.2 which does not contain iOS 7.0 it defaults to the next available version.

    https://github.com/CocoaPods/Specs/blob/d0ec5a65e80656c8d78e12ff19f251df879e0bc2/Specs/a/7/5/AFNetworking/3.1.0/AFNetworking.podspec.json#L21

    Podspecs can define their own deployment target which gets set by the CocoaPods library.

    I do not see any particular issue with CocoaPods library here. Will close this one but please reply here if you feel strongly there is an issue here...

  5. dnkoutso commented on Jan 9, 2018

    @dnkoutso
    Contributor

    Yes, Xcode 9 drops iOS 7.0 support so that's why you get iOS 8.0 instead despite the podspec mentioning 7.0

    https://stackoverflow.com/questions/45640715/how-to-set-up-xcode-9-for-iphone-4-and-iphone-4s-development

  6. Coeur commented on Jan 9, 2018

    @Coeur
    ContributorAuthor

    @dnkoutso , you mean that in a Podspec, I can only forcibly define an exact Deployment Target, I can't simply define the minimal supported Deployment Target?

    When I write a Podspec, I use platforms.ios to define what is at least required to build, not to define what must be built.

    In all case, no matter the Podspec, it is an integration bug from CocoaPods to build for iOS 8+ when we want an iOS 9+ project.

  7. Jinxiansen commented on Jan 11, 2018

    @Jinxiansen

    @dnkoutso @Coeur
    How to specify two different platforms in a pod,
    I have two target, respectively, support for iOS 8 and iOS 9, how to distinguish?

  8. dnkoutso commented on Jan 11, 2018

    @dnkoutso
    Contributor

    I do not think this is supported currently.

  9. Coeur commented on Jan 12, 2018

    @Coeur
    ContributorAuthor

    @Jinxiansen , it doesn't even work for one single platform as described by this bug report. But if one day there is support for multi platforms, then the documentation will tell you. One suggestion could be:

    abstract_target 'default_pods' do
        target 'One' do
            platform :ios, '8.0'
        end
        target 'Two' do
            platform :ios, '9.0'
        end
    end
    

    It's pure suggestion for the future: this is in no way a working piece of configuration in 2018

  10. Coeur commented on Apr 11, 2018

    @Coeur
    ContributorAuthor

    @Jinxiansen don't forget you have to do pod install (or pod deintegrate && pod install) to get the post_install to execute at least once. It will not work with only pod update.

  11. Whirlwind commented on May 30, 2018

    @Whirlwind
    Contributor

    I think the deployment target version should be equal to the user target version.

    If the pod target's deployment version is equal to iOS 9 which define by user target, the dependency will use their new api if they check the deploy version:

    #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100)
                configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier];
    #else
                configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier];
    #endif
    

    The code from the AFNetworking. In the podspec, there is a platforms":{"ios":"7.0","osx":"10.9","tvos":"9.0"}. So the pod target is deploy to iOS 7.0, and the macro will always be false! AFNetworking will always use the old api.

  12. lolgear commented on May 31, 2018

    @lolgear

    @dnkoutso

    So, I have UICKeychainStore in Pods.xcodeproj.

    Pods.xcodeproj has deployments targets:

    Pods (Project) -> 9.0
    UICKeychainStore -> 8.0

    My App deployment target -> 9.3

    I would like to keep them in sync in case of aesthetics.

    @Coeur
    If you can't reopen issue and it have not solved yet, it is time to make open-radar for CocoaPods.

  13. 39 remaining items

  14. Coeur commented on Jul 30, 2019

    @Coeur
    ContributorAuthor

    @icecrystal23 you're probably wrong about that: pod authors may support MULTIPLE versions of iOS, while the podspec only let us define the minimum one.

  15. LinusU commented on Jul 30, 2019

    @LinusU
    Contributor

    [...] but it is not a good general policy that should be blindly applied to all pods.

    I don't really see how that is sustainable, should I only use pods that specifically targets iOS 12? That seems quite strange. Surely there should be no ill effects by compiling with a newer deployment target? 🤔

  16. icecrystal23 commented on Jul 30, 2019

    @icecrystal23
    Contributor

    You guys are still acting like you can't run a library built for iOS 8 on iOS 12. You can. It is a minimum deployment target. Meaning the library supports iOS 8 and newer.

    I don't know what linker errors you are getting, but in general you can compile and link with older minimum targets just fine.

  17. Westacular commented on Aug 2, 2019

    @Westacular
    Contributor

    @LinusU A workaround for the specific issue of dropping 32-bit code when targeting iOS 11+ is to set ARCHS = "$(ARCHS_STANDARD_64_BIT)" in your app target. CocoaPods does automatically copy this setting to all Pods targets. (Xcode will give an "update to recommended settings" warning about this, but that seems like a lesser evil.)

  18. LinusU commented on Aug 2, 2019

    @LinusU
    Contributor

    @Westacular that's amazing, thanks!!

    edit: I haven't been able to trigger this, would you mind elaborating on when it does that?

    Xcode will give an "update to recommended settings" warning about this, but that seems like a lesser evil.

    edit2: Ahhhh, read that the other way around, I thought that Xcode would ask me to go to ARCHS_STANDARD_64_BIT if I targeted iOS 11+ 😄

    Hmm, I wonder why it doesn't use ARCHS_STANDARD_64_BIT for iOS 11+ then 🤔

  19. modified the milestones: 1.8.0, 1.9.0 on Sep 23, 2019
  20. stale commented on Dec 22, 2019

    @stale

    There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

  21. stale commented on Dec 29, 2019

    @stale

    This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

  22. added a commit that references this issue on Sep 22, 2020
  23. SohaibSiddique commented on Apr 29, 2021

    @SohaibSiddique

    I found the following workaround, adding a post_install hook:

    platform :ios, '9.0'
    use_frameworks!
    
    abstract_target 'default_pods' do
        pod 'AFNetworking', '~> 3'
        target 'example'
    end
    
    post_install do |pi|
        pi.pods_project.targets.each do |t|
            t.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
            end
        end
    end
    

    its working for me in 2021

  24. MLukman commented on Sep 3, 2021

    @MLukman

    Still happening today

  25. Coeur commented on Sep 4, 2021

    @Coeur
    ContributorAuthor

    Well, the topic was closed by a bot, not because it was resolved.
    If you wish for a solution that doesn't involve the workaround (see the second post, "Coeur commented on 8 Jan 2018"), then you'd need to create a new GitHub issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    s1:awaiting inputWaiting for input from the original author

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions