I just installed Lion and Xcode 4.1. How do I add older SDKs so I can build and run in 4.1 or 4.2 in iPhone/iPad Simulator? Xcode 4.1 only comes with the iOS 4.3 SDK.
Does Lion have some sort of minimum SDK for builds?
Thanks,
Actually it is possible to add older SDKs as long as you can still get your hands on an older version of Xcode with the older SDK. It's useful too sometimes: when you do this you get to find out about unsupported constants and methods you may be using during compile rather than at runtime. Here's how to do it.
Get hold of an older version of Xcode with the older SDK. The Apple iOS Dev Center currently lists the 4.3 SDK with the Xcode 3.2.6 download.
Mount the dmg and open up the Packages folder hidden within the dmg via Terminal:
open /Volumes/Xcode\ and\ iOS\ SDK/Packages/
Double click the pkg file for the SDK version you want. I was looking for iPhoneSDK4_3.pkg but, in addition to 4.3, found packages as old as iPhoneSDK3_0.pkg. So perhaps older SDKs may still be packaged with the App Store download if you know where to find it (I didn't).
Let it install in it's own folder of choice since you won't be able to force it to install in Applications/Xcode.app/Contents/Developer (which is where the Developer folder is now)
You'll find the package installed in the Platforms folder in the volume you chose. Move the relevant SDK over to the Developer folder within Xcode.app. You'll likely have to use sudo:
sudo mv /Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Restart Xcode and you should see the new (old) SDK listed in your options for Base SDK. Yay!
Update as of 12 Sep 2013
If the "older SDK" you're trying to add comes bundled in Xcode 4.3 or later, adding the SDK is as simple as downloading Xcode from dev center link that says "Looking for an older version of Xcode?" (currently points here), mounting the dmg, then copying the relevant files over.
In terminal, you'd do something like this (edit for the appropriate SDK version number):
cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
For SDKs from versions of Xcode prior to 4.3, the older steps are still relevant.
I found this happens to work for getting the Xcode 5 GM to compile builds that carry the old iOS 6 UI even when deployed on iOS 7 devices. Useful for fixing bugs pending a UI redesign. That said, there's got to be an easier way to get the iOS 6 UI on an iOS 7 device.
You can't. What you can do, however, is click on the top-level entry in the File Navigator. It'll take you to the application settings. Go to the tab called Build Settings, and change the iOS Deployment Target to whatever version of iOS you'd like to support from (the earliest version you support).
See "To Edit a Build Setting…": http://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Building/Building.html#//apple_ref/doc/uid/TP40010215-CH9-SW5
Open Xcode and open Preferences (Xcode -> Preferences menu). Click the Downloads icon and look in the Components tab. All versions from 3.0 to 5.1 should be available. Just click Install for the ones you want to use.
None of these answers worked for me for Mac OS 10.8 and XCode 4.5. But now that things are installed under the Applications folder, it's much easier to manage.
Option #1: Keeping an older copy of XCode is easy to do by renaming it before you install the new one. Then you can use Product->Preform Action->Run Without Building on the new version to test on newer devices or newer simulators.
Option #2: If you REALLY want to build with older SDKs in the newer XCode, then you can simply copy over an SDK using finder. You'll need to have an older version of XCode installed under Applications for this to work. In the following example, I just renamed XCode 4.4 to XCode_old before I installed XCode 4.5. Note: You can right click on the .app file and choose Show Contents to get to these files or just use the cp from a terminal window.
from: /Applications/Xcode_old.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Then, iOS 5.1 will show up under Build Settings as a Bask SDK. You can do the same thing for simulators:
from: /Applications/Xcode_old.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
You can't, but it will build fine for a device that is plugged in running an old version of iOS (what you should be conducting your proper testing on).
You have to run your application in the older version of Xcode that came coupled with the older iOS version. I have 3.2.5 installed under /Developer-3.2.5/. I have to say it's about 10 times faster than Xcode 4... You can download old versions here: http://iphonesdkdev.blogspot.com/2010/04/old-versions-of-iphone-sdk.html
I had a similar issue in Xcode 4.02 for Snow Leopard using SDK 4.3. I wanted to test on an iPhone 3G, but iOS4.2 is the latest (and correct version) for that device. In order to 'see' and run on that device in the Scheme, I had to change the Build Settings for iOS Deployment Target as described above. (btw you also have to have restrictions on the iPhone turned off to let Xcode install the app :) )
In addition to Steven's answer, you can find older versions of XCode - including the older SDKs:
Looking for an older version of Xcode?
Related
I have the latest Xcode 11.1
iOS is updated to the latest release 13.2
I'm getting error:
Could not locate device support files.
This iPhone 6s is running iOS 13.2 (17B84), which may
not be supported by this version of Xcode. An updated
version of Xcode may be found on the
App Store or at developer.apple.com.
This happens to all iOS devices running 13.2
What I'm missing here?
That's easy.
Those files are contained in Xcode itself.
Thus, all you have to do to use devices with a newer iOS version - create junction folder (hard link) of those support files from new Xcode (in our case - the beta 11.2) to older Xcode (11.1).
And yes, before that you have to download beta Xcode 11.2.
Otherwise, you also can download only support files from the Internet, if someone already shared them and just toss 'em to Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
P.S. to create junction folder use this command in terminal:
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
It allows you to not to duplicate the same files across your Mac
P.S. Be aware! You have to launch newer Xcode (Beta) you downloaded at least one time to install updated Xcode Tools before you can use symlinks (hard links, junction folder) to Device Support files in older Xcode, otherwise you'll get an error and will not be able to build your app.
I've been reading about hacks to get it to work on the current version of Xcode. Honestly not interested in going down that path. Bottom line, Apple released iOS/iPadOS 13.2 but did not release Xcode 11.2 (still in beta). Gotta go to developer.apple.com and download the latest beta of Xcode 11.2 to run apps on both iOS and iPadOS 13.2 devices. Hopefully they release Xcode 11.2 soon. The last beta was from Oct 11.
Can we install Xcode 4.6 and xcode 5 on same machine without upgrading from xcode 4.6 to xcode 5?
Yes, you can install multiple versions of Xcode. They will install into separate directories. I've found that the best practice is to install the version that came with your Mac first, and then install downloaded versions, but it probably doesn't make a big difference. See this Apple Developer Connection page for lots of details.
It's easy to have multiple XCode installs.
In the installer there's a pulldown for the location... you just need to pick a new location when you're installing the beta version.
These instructions from an Apple dev tools evangelist have the full details (Apple dev username/password required): https://devforums.apple.com/message/40847#40847
Then grab yourself a custom icon for the Beta version of XCode you're using, so you can tell them apart in the dock: http://iphonedevelopment.blogspot.com/2009/03/multiple-developer-tool-installs.html
I prefer to create separate folders for different versions of Xcode, which I find provides a little more organization than renaming each Xcode release.
My folder layout looks as follows:
/Applications/Xcode.app
/Applications/Xcode4.6/Xcode.app
/Applications/Xcode5.0/Xcode.app
Simply create the necessary folders and drag/drop the relevant Xcode version into the same. You can also download older versions of Xcode from http://developer.apple.com/downloads/ and follow the same idea.
With the folder structure approach, from within a script (e.g. bash shell) you can move between versions of XCode with the xcode-select command line utility by simply specifying the desired folder:
$sudo xcode-select --switch /Applications/Xcode4.6/Xcode.app
Change the release number in the command line to switch to a different version.
Yes, just be sure of having two different names for them!
Yes you can because both can be installed and run simultaneously.
Create a folder with XCode 4 for example and keep XCode 5 in Application Folder.
But, with XCode 5 you can use the property of XCode 4 using iOS 6 sdk. Have a look here.
Anyone have this two versions of Xcode side by side on same machine?
I have Xcode 4.4.1 installed and I want to update to latest version (4.5) so I can use iOS 6 SDK, but I need to keep 4.4.1 for some clients.
Can I make a simple copy of this version and keep installed after upgrade? Because I know some people tried to make this and failed.
Complete a Time Machine backup.
Upgrade Xcode to 4.5.
Restore Xcode 4.4 from the Time Machine backup. (You may have to go back a few hours, depending on how long Xcode 4.5 took to download. Check the file size.) Keep Both.
Rename Xcode (Original) to Xcode 4.4.1.
Once you've done this, just run the appropriate version of Xcode. Xcode 4.5 will update some system components, but these updates won't prevent Xcode 4.4.1 from running.
If you use the command line tools, you should use xcode-select to switch between versions or the environment variable DEVELOPER_DIR to pin to a specific version.
Since Xcode is available on the App Store it's just a regular app. It doesn't install anything under /Developer that could be overridden if you install a new version. All the required files are inside the app bundle (except preferences, docs - those will be shared by multiple Xcode versions)
If you want to be sure, I recommend the following. Backup the old version (to an external hard disk), install the new version and restore the old version with a different name.
The reason some people failed is that when they downloaded Xcode 4.5 from the Mac App Store it overwrote their existing Xcode 4.4.1. The Mac App Store will do this if it sees an existing version of Xcode anywhere. There are two possible solutions:
Don't use the Mac App Store. It is always possible to obtain any version of Xcode as an ordinary download from the Apple Developer site.
Use the Mac App Store, but before you do, zip your existing copy of Xcode. That way, the zipped copy will be kept through the download process. Later, you can unzip it.
Note that two different versions of Xcode cannot exist in the same folder (e.g. top-level Applications) because they have the same name. The easily solution is to put one of them in a subfolder.
I have Xcode 4.5 installed via the App Store, and it has iOS 5.1 and 6.0 support, but not iOS 4.3. Nor is it available for download in the "Downloads" tab of Preferences. I tried grabbing it from another computer and putting it on this one, as described by Dominik Porada, but alas that did not work. Maybe there are other files I need? How do I get the iOS 4.3 SDK back?
I actually did get 4.3 to appear in the Xcode 4.3 menu just by copying the iPhoneSimulator4.3.sdk file to the Xcode.app package, as described by Dominik Porada. I think I just had to restart Xcode again, and there it was!
But it doesn't work. As pointed out in the answers to this question, iOS 4.3 is not supported on Mountain Lion. Might work fine for Lion, though.
This was the solution to run iOS 5.1 in XCode 4.2. Try following the same procedure. Try copying it from a previous version of XCode.Haven't tried it out myself.But see if it works.
To get Xcode 4.2 on Snow Leopard to run code on a device running iOS 5.1 you can do this:
If you have another Mac running Lion and Xcode 4.3.1 you can copy the files from:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.1 (9B176)
Place the copied files in the equivalent place on your Snow Leopard Mac: probably
/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Similarly copy the iOS 5.1 SDK files found in this directory:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
Also copy 'version.plist' from the Lion machine in the iPhoneOS.platform folder to the Snow Leopard machine.
Re-start Xcode on the Snow Leopard machine and re-connect the devices and it seems happy enough.
If you don't have access to a machine with Lion and Xcode 4.3.1:
You can get the files out of the 4.3.1 DMG which can be downloaded from Apple here: Downloads for Apple Developers.
Mount the DMG, Show Package Contents on the Xcode icon and drill down to
/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Follow the steps above.
You might find it more convenient to use Apple's proprietary ditto method (sudo ditto src dest) in the terminal window to copy the folders.
I just upgrade my Xcode to 4.2 because I upgraded my MacOS to Lion.
In this version of Xcode. only includes SDK 4.3, I can set the Deploy Target to 4.0 or other lower version, but different from old Xcode, I can't launched Simulators for lower SDKs.
I also tried download & install lower SDKs from old Xcode package, but seems it doesn't works.
So, in this situation, how I can publish app to support lower SDK devices?
THX~
Try opening XCode preferences, go to Downloads, and install the various debugging support options that are present.