Compile project to iOS 5.1 with xCode 4.2
If we need to compile and simulate a project in iOS 5.1 and we have only Xcode 4.2 or lower version, the default is not possible.
iOS 5.1 is only supported in Xcode 4.3.1., so we can upgrade Xcode when we are able to do that.
To upgrade to Xcode 4.3.1 is necessary to upgrade Lion.
If you do not want to reinstall the entire Xcode, but still want to compile a project for iOS 5.1, you can add support to your Xcode.
All supported versions we can see the directory:
Here we see all the directories that contain the necessary libraries, and I just need to add support for iOS 5.1 to 5.1 (9B176)
If you have access to Xcode 4.3.1 installed, you can copy this directory 5.1 (9B176) width iOS 5.1 support.
If you can not do this, download XCode 4.3.1 Lion DMG file and mount it.
Turn on the Terminal (Applications->Utilities->Terminal).
Now gradually enter the following:
sudo cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
sudo cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
sudo cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.1 (9B176) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/
sudo rm -f /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest
sudo ln -s ./5.1 (9B176) ./Latest
Now you can run an application on devices with IOS 5.1