Skip to content
This repository

Specify iOS SDK version to use #624

Closed
Zyphrax opened this Issue · 29 comments

15 participants

Yvo van Beek 邢大为 Fabio Pelosin John Clem swizzlr Mark Aufflick Stefan Fisk Thomas van der Heijden Adam Sharp alfonzzz Daniel Kuhnke michaeldove LoganGauthier Chris Shepherd Kyle Fuller
Yvo van Beek

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'

Yvo van Beek

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

Yvo van Beek

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?

Fabio Pelosin

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?

Yvo van Beek
Fabio Pelosin

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?

Yvo van Beek
John Clem

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.

Yvo van Beek

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

Fabio Pelosin
Owner

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.

swizzlr
Collaborator

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.

Mark Aufflick

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).

Stefan Fisk

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.

Thomas van der Heijden

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.

Fabio Pelosin
Thomas van der Heijden

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).

Yvo van Beek

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.

Thomas van der Heijden

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'
    end
  end
end
Adam Sharp

@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?

alfonzzz

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.

michaeldove

+1 for a first class solution.

LoganGauthier

@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.

Thomas van der Heijden

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

LoganGauthier

@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!

Chris Shepherd

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.

Fabio Pelosin

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

Kyle Fuller kylef closed this
Kyle Fuller
Owner
kylef commented

Closing, this is now tracked in #1576.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.