Specify iOS SDK version to use #624

Zyphrax opened this Issue Nov 1, 2012 · 29 comments

I couldn't find it in the FAQ, is there a way to specify the SDK version to use in the project?

When I run pod install the generated Pod project is always 6.0.
How can I specify it to create the Pod project with iOS SDK version 5.1?


platform :ios, '5.1'


That will still create a 6.0 Pods project.
It will only validate that all Pods are at least compatible with iOS SDK 5.1


pods project' sdk doesn't matter. Never mind it @Zyphrax


I've added CocoaPods to an old PhoneGap project.

The version of the project has to be iOS SDK 5.1, because otherwise I'll run into orientation issues (due to the new orientation system in iOS 6.0). The problem won't occur on iOS 5.1 devices, but the orientation is wrong on iOS 6.0 devices.

When the project is set to iOS SDK 5.1, it all works fine on both iOS 5.1 AND 6.0 devices.
However I can't combine a Pods 6.0 SDK project with a 5.1 SDK project.

In summary: projects compiled with iOS SDK 5.1 give a different result to projects compiled with iOS SDK 6.0 on iOS 6.0 devices.

So still - is it possible to force an iOS SDK version?

CocoaPods member

That will still create a 6.0 Pods project.

By default CocoaPods should generate a 4.3 project, you can specify any deployment target as @scutdavy suggest. So I don't understand why you are getting a 6.0 project. Mind posting the Podfile?

CocoaPods member

After investigation I see that the issue is that the project has the default deployment, (while the Pods library is correctly configured for 5.0). It this correct?


Is this still an active issue? I'm planning on poking around and seeing what I can come up with for it, but wanted to make sure it was still worth pursuing.


We are now able to use the latest iOS SDK for our project so it's no longer a problem for us.

The problem is still there:

  • Lets say you want your project: MyApp to be using iOS SDK 5.1 (Base SDK under Build settings)
  • The Pod project should then target the same SDK: iOS SDK 5.1
  • Whenever you run pod update the Pod project will revert to Latest iOS

Please note: the platform target != base SDK version.
The platform describes the minimum version in terms of compatibility.
The base SDK describes the SDK version (header files) used for compilation.

More info: developer.apple.com - SDK Compatibility Guide - http://goo.gl/khtpb

CocoaPods member

I'm closing this one as this is the only report and devs are advised to link against the latest SDK. If somebody still has this problem, please report.


I've discussed this briefly with @orta on Twitter, and he seems to agree with the conclusion which was arrived at.

Put simply, I'm running Xcode 5 for its fabulous new IB. As an enterprise developer I am constrained by client and budget right now to not support iOS 7. Fine, though, Xcode 5 is meant to happily support older SDKs. Unfortunately, Cocoapods' default setting of "latest SDK" is causing nasty linker crashes on load. There is a workaround, which is to manually set each target to iOS 6.1. This is reset at every install. If it is considered too much of an edge case for Cocoapods to support, I understand, though if anybody has knowledge of the ruby gem it would be fantastic if you could guide me in writing a bash script that can manually overwrite the target SDKs. I'll happily share it with the rest of the 0.01% who are in this frustrating position.


I have the same issue atm. Not the linking issue, but I'm working on a quick release for an existing app so we're sticking with linking against the iOS 6.1 SDK.

I'm using Xcode 5 not primarily for the UI but so I can build and test onto iOS 7 devices.

So what I want to do is have the base sdk set to 6.1 instead of 'latest'. At the moment it gets wiped out every time I run pod install (which I'm doing a bit since I'm migrating external dependencies from submodules to pods).


This is causing me major issues as well, for exactly the same reasons. The 7.0 SDK breaks our app for various reasons, and It might take us months to start working on a proper iOS 7 release. Until then I'm stuck with fiddling with settings manually only to have them overwritten.


In the same boat. Due to the interface changes there will be a lot of people initially needing to build against the old SDK (6.1) until they have the time to upgrade the UI to 7. As long as an app is build against 6.1, it will look the same on IOS7 as on IOS6. The moment you build against 7, you are forced to use the new UI elements.

CocoaPods member

My preference would be a DSL attribute as that would give me full control against which SDK the pod project would build.

I'm not sure if you could make auto detect reliable enough (esp if you have multiple targets).


I'd prefer a DSL attribute.

For example:

  • I'm using Xcode 5 which defaults to iOS 7
  • My project is targetting iOS 6.0 and higher
  • I want to build against iOS SDK 6.1

Another option would be manually set the Pods project to the right SDK version and make sure that CocoaPods won't overwrite it. That way Xcode will make sure that the developer only selects an SDK thats actually installed.


I've found a workaround. Using a post-hook to force 6.1 SDK. Add this to the end of your Podfile:

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SDKROOT'] = 'iphoneos6.1'

@batkuip Thanks for the workaround, that's really great.

+1 for this from me, our project isn't in a position to update base SDK yet.

@irrationalfab What are your thoughts on reopening this?

@fabiopelosin fabiopelosin reopened this Sep 23, 2013

Huge +1 to @batkuip
We're in the same position - required to build with the 6.1 SDK for the time being. A DSL attribute would be nice and concise although @batkuip's solution works fine.




+1 for a first class solution.


@batkuip Does that solution work for you from CL? When I run pod install with that fix, my Pods project shows that it's using 6.1 as the base sdk, but the build produced seems to have used 7.0.


@LoganGauthier no troubles here. What do mean with "seems to have used 7.0"? Did you check your main project?


@batkuip I'm not really sure what the problem was. My main project had the base sdk set to 6.1 and the deployment target set to 6.0. After running pod install with your base sdk fix, when I built my main project on my iOS 7 device, the status bar was missing as if I had used 7.0 as my base sdk. However, when I built the pods target within xcode (with 6.1 set as the base sdk), I could then build for my device and the status bar would be there.

I just tried again though and now it's working fine. Thanks!


Thanks for the solution. I found I had to set the BaseSDK to 6.1 for the whole Pods project as well as having each Pod target set to 6.1 for the iOS6 UI to come back on iOS7.

CocoaPods member

To my understanding #1576 should fix the last remaining points with this issue. CocoaPods already infers the target's SDK unless specified.


Closing, this is now tracked in #1576.

@kylef kylef closed this Mar 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment