I am wondering how to handle running two versions of xcode on a mac, or if it is even possible.
I currently have a number of production apps that I service with the release xcode7. I must have this available for uploading app versions to the app store.
I also have a ipod touch device I have the ios9.1 beta running, and want to test and write code for the new os.
However, xcode7 says I can't test ios 9.1 beta, that I have to install xcode beta. Also, I've read that you can't push apps to the app store with the beta. So how can you maintain current apps, as well as, build new functionality?
Maybe I have missed something? some setting that allows me to toggle between these xcodes? or will the mac allow me to have two different versions of XCode installed? I assumed it would just override the other.
I don't want to buy another mac, or to partition the one I have, or keep downloading and installing different versions on all the devices, if I don't have to.
Any information would be helpful, how does everyone else handle this?
You simply need to rename them in /Applications; for example:
Xcode 6.4: /Applications/Xcode6.app
Xcode 7.0: /Applications/Xcode7.app
Xcode 7.1 beta: /Application/Xcode-beta.app (the default anyway).
They will co-exist perfectly happily, however if you do command line builds, you'll want to use xcode-select to select the version you want to use when using xcodebuild or clang, etc.
The betas generally come with the name Xcode-beta.app (this is true for the iOS 9.1 beta), so you can just download it and copy it to the /Applications folder as usual.
In the rare cases where that's not true, you can just rename Xcode.
You can install both versions. They will happily co-exist in your /Applications folder. One will be called Xcode, the other will be called Xcode-Beta
I have updated my mac with ios7 xcode 5... ui is change... can i build my pp with older version. i mean is there any seeting which will allow me to build my app on older version from new one.
Thanks
AFAIK .. The only way to do this will be to download the older SDKS and link them to XCode.
With iOS7 SDK you can still set your deployment target to iOS6 and things like Autolayout etc will work.
Really supporting older versions of the SDK might actually not be worth it since API deprecations etc might cause your app to break in the real world.
I found solution to my problem after doing experiments... hope this is correct as result is what i wanted...
i copied all SDK from my old Xcode 4.6 folder after opening content package folder and then found SDKs inside to my new Xcode5 folder.
then i got option to change base SDk was showing both SDK for new and old ios. selected for 6.1 and also deployment target to 6.1....and yes i got my UI back ....everything was same that for ios6.1.
hope i will not get any issue when i will upload it on itunes...
Set your deployment target to 6.0 in your Xcode5 project.
Build & Archive your project to create an .ipa file.
Install it in your iOS7 device using iTunes.
Xcode 5 has a preferences pane that allow one to download iPhone 6.1 simulator, however I can't find a place where it allows downloading of iOS 6 SDK, thus it is not possible to set the active SDK to iOS 6 when developing with Xcode 5. Is there a workaround that would allow Xcode 5 to install iOS 6 SDK?
EDIT:
Workarounds should no longer be necessary now that Xcode 5 is generally available and allows you to download previous versions of the SDK.
EDIT: Starting Feb 1, 2014, Apple will no longer accept pre-iOS7 apps for submission to App Store. So while this technique still works, it will not be useful for most readers.
Yes, this is fine. I still build with iOS 4.3 for one project (it's been awhile since we updated; but they still accepted it after iOS 6 came out), and I currently build 10.5 apps with Xcode 5.
See How to point Xcode to an old SDK so it can be used as a "Base SDK"? for details on how to set it up. You can use my fix-xcode
script to link everything for you every time you upgrade.
The only trick is getting the old SDKs. If you don't have them, you generally need to download old versions of Xcode (still available on developer.apple.com), open the installer package, and hunt around to find the SDK you need.
SDKs can be found within the installer package at:
Xcode.app/Contents/Developer/Platforms/
I was also running the same problem when I updated to xcode 5 it removed older sdk. But I taken the copy of older SDK from another computer and the same you can download from following link.
http://www.4shared.com/zip/NlPgsxz6/iPhoneOS61sdk.html
(www.4shared.com test account test#yopmail.com/test)
There are 2 ways to work with.
1) Unzip and paste this folder to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs & restart the xcode.
But this might again removed by Xcode if you update xcode.
2) Another way is Unzip and paste where you want and go to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs and create a symbolic link here, so that the SDK will remain same even if you update the Xcode.
Another change I made, Build Setting > Architectures > standard (not 64) so list all the versions of Deployment Target
No need to download the zip if you only wanted to change the deployment target.
Here are some screenshots.
Yes, I just solved the problem today.
Find the SDK file, like iPhoneOS6.1.sdk, in your or your friend's
older Xcode directory.
Copy & put it into the Xcode 5 directory :
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs.
Then you can choose the SDK like below :
Hope this helps you.
Find and download old SDK. Older SDKs are found here.
I have copied the xcode.app directory as Xcode_4.6.3.app.
Now you can test and debug in both xcode versions. You have to run them from the corresponding folders or create shortcuts in your desktop. When building from command line give the parameter as iPhoneOS6.1 instead of iPhoneOS7.0
This worked great for me in Xcode5 and iOS.
Go to into Xcode5's SDK dir. Its usually located at:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Add a symbolic link to the old SDK like this:
sudo ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk iPhoneOS6.1.sdk
Or more accurately from anywhere in the command line,
sudo ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
You can download the older SDK and install it in
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
folder. Logout + Login just to make sure the changes take effect and you should see the older SDK in your new XCode
Just to add, you can actually download old versions of the simulator with Xcode 5 itself - just go to preferences and you'll find them under Downloads:
Download Xcode 4.6.x from the Apple Dev Center: https://developer.apple.com/downloads/index.action
Create a folder called Xcode4 within the Applications folder and drag-n-drop the downloaded dmg there.
Open a terminal window
$sudo cp -R /Applications/Xcode4/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
You will be prompt to enter a password since you're inside a system folder
Open Xcode 5 and you should now see both SDKs
Just for me the easiest solution:
Locate an older SDK like for example "iPhoneOS6.1 sdk" in an older version of xcode for example.
If you haven't, you can downlad it from Apple Developer server at this address:
https://developer.apple.com/downloads/index.action?name=Xcode
When you open the xcode.dmg you can find it by opening the Xcode.app (right click and "show contents")
and go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1 sdk
Simple Copy the folder iPhoneOS6.X sdk and paste it in your xcode.app
right click on your xcode.app in Applications folder.
Go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Just paste here.
Close your xcode app and re-open it again.
To test an app in iOS 6 on your simulator:
- Just choose iOS 6.0 in your active sheme.
To build your app in iOS 6, so the design of your app will be the older design on an iPhone with iOS 7 also:
- Choose iOS6.1 in Targets - Base SDK
Just note : When you change the base SDK in your Targets, iOS 7.0 won't be available anymore for building on the simulator !
Can do this, But not really necessary
How to do this
Jason Lee got the answer. When installing xCode I preferred keeping previous installations rather than replacing them. So I have these in my installation Folder
So /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs Contain different sdks. (Replace Xcode.app with correct number) copy previous sdks to
/Applications/Xcode 3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Here is my folder after I copied one.
Now restart xCode and you can set previous versions of sdks as base sdk.
Why it is not necessary
Refering Apple Documentaion
To use a particular SDK for an Xcode project, make two selections in your project’s build settings.
Choose a deployment target.
This identifies the earliest OS version on which your software can run.
Choose a base SDK
Your software can use features available in OS versions up to and including the one corresponding to the base SDK. By default , Xcode sets this to the newest OS supported by Xcode.
Rule is Use latest as base SDK and set deployment target to the minimum version app supposed to run
For example you can use iOS 7 as base sdk and set iOS 6 as deployment target. Run on iOS 6 simulator to test how it works on iOS 6. Install simulator if not available with list of simulators.
Additionaly You can unconditionally use features upto iOS 6. And Conditionally you can support new features of iOS 7 for new updated devices while supporting previous versions.
This can be done using Weakly Linked Classes ,Weakly Linked Methods, Functions, and Symbols
https://developer.apple.com/library/ios/documentation/developertools/conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-SW3
Weak Linking
Suppose in Xcode you set the deployment target (minimum required version) to iOS6 and the target SDK (maximum allowed version) to iOS7. During compilation, the compiler would weakly link any interfaces that were introduced in iOS7 while strongly linking earlier interfaces. This would allow your application to continue running on iOS6 but still take advantage of newer features when they are available.
The other answers here are correct too, but I find the following steps to be the easiest:
Just download Xcode 4.6.3 from the dev center link that says "Looking for an older version of Xcode?" (currently points here) and mount the dmg.
Then in terminal, copy the SDK files over:
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/
Finally, relaunch Xcode and you're done.
My app was transitioned to Xcode 5 seamlessly because it can still build with the original iOS Deployment Target that you set in the project (5.1 in my case). If the new SDK doesn't cause some insurmountable problem, then why not build using it? Surely there are many improvements under the hood.
For example, I will much prefer to use Xcode 5 instead of Xcode 4.6.3. Why? I'll get a lot more battery life because the UI scrolling of text/code areas in Xcode 5 no longer chews up an entire CPU thread.
Linking the 6.1 SDK into Xcode 5 as described in the other answers is one step. However this still doesn't solve the problem that running on iOS 7 new UI elements are taken, view controllers are made full-size etc.
As described in this answer it is also required to switch the UI into legacy mode on iOS 7:
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:#"UIUseLegacyUI"];
[[NSUserDefaults standardUserDefaults] synchronize];
Beware: This is an undocumented key and not recommended for App Store builds!
Also, in my experience while testing on the device I found that it only works the second time I launch the app even though I'm running the code fairly early in the app launch, in +[AppDelegate initialize]. Also there are subtle differences to a version built using Xcode 4.6. For instance, transparent navigation bars behave differently (causing the view to be full-size).
However, since Xcode 4.6.3 crashes on Mavericks (at least for me, see rdar://15318883), this is at least a solution to continue using Xcode 5 for debugging.
I downloaded XCode 4 and took iOS 6.1 SDK from it to the XCode 5 as described in other answers.
Then I also installed iOS 6.1 Simulator (it was available in preferences). I also switched Base SDK to iOS 6.1 in project settings.
After all these manipulations the project with 6.1 base sdk runs in comp ability mode in iOS 7 Simulator.
From 1st february Apple will reject app built only for iOS6 or lower. Here is also the official communication from Apple. Better start building for iOS7.
To clarify my statement: If you build for iOS6 or lower, apple will reject your app.
If you build for iOS7 AND lower everything is fine, this means:
you must use xcode5
you should deploy on iOS7 at least.
The content of the Apple email is pretty clear at me
"Make sure your apps work seamlessly with the innovative technologies
in iOS 7. Starting February 1, new apps and app updates submitted to
the App Store must be built with Xcode 5 and iOS 7 SDK."
I currently have Xcode 4.6.3 and 5.0 installed. I used the following bash script to link 5.0 to the SDKs in the old version:
platforms_path="$1/Contents/Developer/Platforms";
if [ -d $platforms_path ]; then
for platform in `ls $platforms_path`
do
sudo ln -sf $platforms_path/$platform/Developer/SDKs/* $(xcode-select --print-path)/Platforms/$platform/Developer/SDKs;
done;
fi;
You just need to supply it with the path to the .app:
./xcode.sh /Applications/Xcode-463.app
I know this has been discussed before, but I didn't quote understand most of the answers. As you can tell from my other questions on here, I'm a complete newbie when it comes to app creation using XCode. I only have the SDK for iOS 4.3.
A friend of mine wants my app, but he only has an iPhone 3. He has not upgraded to iOS4. I don't see any reason my app couldn't run at a lower iOS version, it's pretty simple.
So what I'd like to know is how can I add previous SDKs to my XCode library? Do I just download a previous version of XCode w/ it's SDK and install that? Will that brick XCode? If so, what then? Is there anything I can do, I'd really like this to be written with 3.x and above in mind.
The most simple and more straight forward answers without jargon will be extremely appreciated!
Thank you!
if you have the iOS 4.3 SDK, you also can target any iOS version preceding it. In your Xcode project build settings, make sure your base SDK is set to the highest you have (in this case 4.3) but change your deployment target to whatever iOS version you want (try not to go lower than 3.0).
Make sure you test it though, to be sure that you are not using any features that are not present in the SDK version you are targeting.
Each download of the iOS contains each (most) of the previous versions. They're in installer bundles in a folder on the disk image. For example in the xcode_4.0.1_and_ios_sdk_4.3.dmg, (after you have installed the main package) open the Packages folder, install the iPhoneSDK3_2.pkg, and iPhoneSimulatorSDK3_2.pkg (if needed).
I have read that you can have multiple SDKs in Xcode 4 installed in the Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs directory. What was not made clear is how you can get these different SDKs. I'd at least like to test for iOS 4.0 instead of the latest iOS 4.3. Though it would be cool to test for 3.2 also. My Xcode 4 installed only with the latest 4.3 SDK in this directory. Is there a convenient way to add them?
When you install Xcode 4.0, your previous version get's renamed to something like "Developer-3.2.5". If you still have a previous version of Xcode installed you can simply do this:
cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
sudo ln -s /Developer-3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk .
sudo ln -s /Developer-3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk .
If you don't have a previous version installed, uninstall Xcode 4.x and then install Xcode 3.2 and start progressively from there. After you install Xcode 4.x your previous version of Xcode 3.x will get renamed on disk after which you can symlink the 4.0/4.1 SDKs under Xcode 4.0. Relaunching Xcode 4.0 will give you 4.0 and 4.1 in the drop down option list.
No there is not a convenient way, unfortunately. The easiest way is to install an earlier version and then upgrade it, progressively if necessarily, to the latest version.
The XCode downloads available from http://developer.apple.com/downloads appear to contain packages going back to before 4.0. I recently hit this same issue and was able to determine that:
From 4.1 onward (Maybe earlier - still waiting for the download for XCode 3.2.3 and SDK 4.0.1), the packages contain sub-packages named quite similarly
Despite the inner package name, it appears that the actual iOS SDK will be included for the version mentioned on the primary DMG file. For instance, xcode_3.2.5_and_ios_sdk_4.2_final.dmg may contain what appears to be SDK packages for a bunch of versions, but the iOS SDK is only fully included for 4.2.
I was able to get my hands on 4.1, 4.2, and 4.3 by downloading the DMG XCode installers, viewing package contents, and running the corresponding iPhoneSDK4_X.pkg installer.
After installing, I had to copy the stuff it dropped from /Platforms/iPhoneOS.platform/ into the new location at /Developer/Platforms/iPhoneOS.platform.
In addition to the SDKs for iPhoneOS, I also made sure the iPhoneSimulator.platform stuff was there. For me, it seems that XCode handles installing most device support for debugging..
I hope this helps! The tricky part for me was realizing that the package names may be the same, yet the contents may be different. Each download only seems to have included a single full SDK.
Once I did this, i was able to change my base SDK in XCode and build against the target SDK.
Cheers!
PS: Once you add additional SDK's, you will likely see additional destinations appearing in your schemes list with identical device names for the physical devices. It drove me nuts, as each one is associated with one of the SDK's, yet the SDK version isn't listed in the list. Not bad once you figure out which is which, usually the symptom being a failed build, since it targets another SDK based on which physical device is selected. More info on this post: duplicate device scheme in xcode 4