37

I copied the iOS 5.1 SDK here:

Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

But, I still can't choose the base SDK in Xcode. Can anybody help?

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
sinopec
  • 851
  • 1
  • 9
  • 16
  • Please better explain what you are trying to accomplish. – Mick MacCallum Sep 21 '12 at 03:37
  • I am trying to build app based on SDK5.1 in XCode4.5. – sinopec Sep 24 '12 at 02:09
  • 3
    If you are targeting iOS 5.1 devices, you can build using the iOS 6 SDK. You just have to change the Deployment Target to 5.1 (or earlier). This will allow the app to be installed on devices running an iOS version prior to 6. – Russell Thackston Nov 13 '12 at 17:27
  • @RussellThackston True, but when you add new XIBs they default to using the iOS6 format (with AutoLayout and such) which you always have to manually change back to iOS5 format. – Marplesoft Feb 21 '13 at 00:43
  • The reason why I did this: if you compile against an older SDK, you will get errors and warnings about methods that didn't exist for that version yet. You won't get those errors when building using the newer SDK, even if you set the target to an older version. – Jelle Apr 28 '13 at 18:46

8 Answers8

58

You need to copy the iPhoneOS5.1.sdk to the directory

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk

and iPhoneSimulator5.1.sdk to

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk

(You'll need to restart Xcode to be able to select the SDKs in the Base SDK build option.)

damian
  • 3,604
  • 1
  • 27
  • 46
Guru
  • 4,693
  • 3
  • 25
  • 45
52

None of the above worked on my 10.8 xcode 4.5.1. Most of the paths given above are not found.

Here is my solution note.

  1. Download xcode_4.4.1_6938145.dmg in https://developer.apple.com/downloads/
  2. Load up the dmg file then go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ you will find iPhoneOS5.1.sdk (this is what i want in this case).
  3. Copy iPhoneOS5.1.sdk folder into your Xcode folder /Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
  4. Restart Xcode
  5. Open Xcode project setting->build settings->base SDK, then you will see iOS 5.1 option.
Community
  • 1
  • 1
Marku
  • 1,854
  • 15
  • 13
  • 5
    this worked and should be the correct answer! download the older versions of xcode here https://developer.apple.com/downloads/index.action# (need a developer account of course) – minovsky Dec 01 '12 at 18:12
  • Also, this can be done for the Simulator as well, but note that the simulator can be downloaded from within XCode, it's just quicker to do it here at the same time. – Bernesto Jan 23 '13 at 23:14
  • 2
    In step 2. and 3. I had to right click on the Xcode icon and click Show Package Contents to be able to go to Contents/Developer.... (just for the novices in OSX) – zajac.m2 Feb 26 '14 at 15:08
3

From the terminal, run this command, then restart XCode:

cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

Note, substitute 'iPhoneOS5.0.sdk' with the name of whatever SDK you're interested in copying.

benvolioT
  • 4,507
  • 2
  • 36
  • 30
2

@benvolioT answer is correct, but you need permission:

sudo cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Yogesh Suthar
  • 30,424
  • 18
  • 72
  • 100
user1375355
  • 79
  • 1
  • 4
1

Old SDK's for the OS and Simulator might be available from these locations using finder.

For OS

/Developer-old/Platforms/iPhoneOS.platform/Developer/SDKs

For Simulator

/Developer-old/Platforms/iPhoneSimulator.platform/Developer/SDKs

Developer-old, you would find it in device volume path.

Devaski
  • 411
  • 6
  • 14
1

Akhildas' solution worked for me. I was able to build against the 5.1 SDK with XCode 4.5.1. One caveat:

If you drop an SDK from a version of XCode downloaded by a different Apple ID, the App Store will show that you have an update to 4.5.1 (even though you already have it). When you press the update button, it tells you to log in with the other Apple ID.

Strange, I wonder where the account information is buried in the 5.1 SDK?

Also, when I set a base SDK back to iOS 6, it appears you have to restart XCode to recognize that framework.

Dave
  • 168
  • 1
  • 17
1

xcode.app > Right Click > Show Package Contents

It will open xcode package contents.

Go to the directory path -

Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

Now you can see the folder name with ios sdk version. For example : iPhoneOS(sdk-version).sdk

Deep
  • 416
  • 6
  • 15
0

The BEST SOLUTION is to go to the XCode Preferences and to install older versions of iOS simulator / SDK from there, as explained here : https://apple.stackexchange.com/questions/47323/installing-xcode-with-ios-4-3-device-simulator

Hope this helps :)

Community
  • 1
  • 1
toto_tata
  • 14,526
  • 27
  • 108
  • 198