Recently released Apple iOS SDK 5.1 only includes iOS Simulators starting from version 4.3. However, ensuring your application works on iOS 4.2 might be a good idea, because this is the latest version officially available for iPhone 3G and iPod Touch 2G. It is probably fine to drop iOS 3.x support already (and, thus, original iPhone and iPod Touch 1st generation devices). At least many people suggest you do. But it might be little bit early to abandon iOS 4.2.
Unfortunately, Apple won't agree. Latest iOS SDK 5.1 doesn't have iOS Simulator 4.2 support and to make things even worse requires you to upgrade to Lion 10.7.3. Which in turn makes it difficult to install older SDKs. Though this may be possible, but I prefer no to mess things up by having a multiple versons of Xcode and iOS SDK around. There is a better solution. It is possible to add iOS Simulator 4.2 support to Xcode 4.3.1.
First, you need to find and download older SDK disk image:
xcode_3.2.6_and_ios_sdk_4.3.dmg. Apple might still have it somewhere inside Member Area. If not it can be simply found with your favorite search engine. Actually, you only need file called
iPhoneSimulatorSDK4_2.pkg. I had a luck finding it directly, so had no need to download the whole dmg. I am not giving any direct links here, since this might be illegal :) So if you downloaded the whole dmg, mount it.
iPhoneSimulatorSDK4_2.pkg is inside the invisible
Now you need to install this package, but into some temporary folder. Double-click it and on destination disk screen click the disk. This will reveal the «Select folder...» button. Wait for installation to complete.
Now quit Xcode if you are running it. Then go to
%Your Temporary Dir%/Platforms/iPhoneSimulator.platform/Developer/SDKs, and locate a folder named
iPhoneSimulator4.2.sdk. Now open Xcode application bundle (it should be
/Applications) and move
/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs. Now you may delete the temporary folder.
Restart Xcode and if your project supports 4.2 (i.e. it has Deployment Target lower or equal to iOS 4.2) you may run it on iOS Simulator 4.2.