I copied the iOS 5.1 SDK here:
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
But, I stil
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.
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.
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 :)
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.
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
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.)