Xcode terminates when clicking on XIB file - ios

I want to test my app in iOS 6. Currently I am using Xcode 6
I read some articles that state "you have to download older versions of Xcode (e.g. Xcode 5) and in Xcode 5 download the iOS Simulator 6 and then run in it."
But if I do it like that, I am getting the following errors for only specific XIB files like:
Command /Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool failed with exit code 255
How I can fix this issue?

You are usually able to copy simulators from one Xcode to another, effectively installing the iOS 6 simulator into Xcode 6 like you want to. However, in looking around, it seems as though Xcode 6 doesn't support simulators under iOS 7.
My recommendation would be to install Xcode 4 or 5 and run your app there, but it sounds like you've already developed some of your app using Xcode 6. If that is the case, you'll have a lot of warnings. It's not a good idea to develop an app in a newer version of Xcode then run in an older version. Apple tries to get out the bugs when updating your Xcode version, but I doubt they do much testing or work on supporting downgrading the version.
If your xib files aren't complicated, you might rebuild them in the older version of Xcode and try to run again. There's almost always something that changes in how Apple formats xib files with each version. I believe that's what's causing your problems.

If you want to open xibs made in Xcode > 5 in Xcode 5, you will have to specifically save them in Xcode 5 format:
Of course, then you won't be able to use any modern features, e.g. size classes.

Related

Is it safe to upgrade XCode 4.6.3 to Xcode 7?

I have developed a Universal App that works on both an iPad running iOS 9.3.5 & an iPhone running iOS 6.1.4, using two different Storyboards.
I realise that I need to upgrade in order to be able to distribute my App on the App Store.
Can I run Xcode 7 on OS X Lion? And, more importantly, will my Objective-C code still work in Xcode 7?
The code I am using is very basic. I am essentially using a UINavigationController to present data from an SQLite database.
I am not using any animation, location services or camera based classes.
At the moment, I have set my deployment target as 6.1.
I am using 2 third party frameworks: SSZipArchive & Reachability
Can anyone give me some reassurance, before I assign a month's worth of work to the scrap heap?
It is really hard to tell, since it means jumping 3 versions (!) ahead. Anyway, I wholeheartedly recommend you to set git in your project, to make sure you can always revert if something goes wrong. BTW- I would recommend updating to Xcode 8, the latest version of Xcode.
Following are the answers to your queries :
Which version of Xcode 7, you will be using? You will have to upgrade your OS too to run Xcode 7 as it runs on OS X 10.10.4
Your code will probably work on Xcode 7, but you might have to tweak a few things. But you will have a lot of online help to fix these issues.
From Xcode 7s Release notes:
Xcode 7 requires a Mac running OS X 10.10.4
In general, you can copy /Applications/Xcode.app to /Applications/Xcode_4_6_3.app and than update (or maybe better install) Xcode 8beside it, so you can always use your legacy version side-by-side.
Without knowing your code nobody can tell if it needs modifications to build under Xcode7. As the step from Xcode 4 to Xcode 7 is big, plus you want to build for the App Store and therefor have to target iOS 10, I assume you will have to tweak your code due to deprecations and such.
You need to build with Xcode8 to archive this btw.
If you were working with Storyboard, I would also expect issues as Storyboard has been developed a lot in between.
Will my MacBook Pro OSX Lion, handle the XCode 4.6.3 to Xcode 7
Absolutely not. Xcode 7 requires a much later system version than Lion.
In general what I have done in your situation is to install the required system and Xcode onto an external drive or a partition on the internal drive, and boot from that. This allows me to experiment and see whether the transition is going to work.
There is no need, therefore, to guess — which is what it appears you are trying to do.

Run release and beta version of XCode

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

Can i transfer my Xcode 5.1.1 contents in project file into Xcode 6

Can everything just simply copy and paste over from Xcode 5.1.1 to Xcode 6 for Objective-C? I don't want to re-create the entire game app from scratch on Xcode 6. If i could just copy and paste from Xcode 5.1.1 to Xcode 6 i'd do it. Or does Xcode 6 completely overwrite and delete Xcode 5.1.1 projects?
Is it possible to implement iOS 8 and 4.7 inch and 5.5 inch iPhone simulators in Xcode 5.1.1?
There is no need to update any projects to be compatible with Xcode 6 if they were created in Xcode 5. Simply open the project file (or the workspace if you're using that, such as with CocoaPods), and ensure that it's using the Xcode 6 program.
There are some differences between the two versions, but nothing that will cause your project to break. The main worry for that is updating to be using the iOS 8 SDK, but that usually is simply new deprecated warnings. If you have problems with that, ask a separate question with details on that.
You cannot use Xcode 5 to work in iOS 8 and the 4.7 inch/5.5 inch sims. Even if you found a way, you shouldn't - Xcode 6 will receive the new updates and patches from Apple, so you should go ahead and upgrade. It's relatively painless, I promise. (Now, anyway... it was rough when it first came out, but that time has mostly passed.)
Additionally, you'll want to re-download the 7.1 simulators, as they do a sort of half uninstall whenever you update Xcode. You can access the download button for those through Xcode -> Preferences -> Downloads. Just click the button to the right of the sims (and the docs if you're interested in those). It won't be a full download, mostly just a reinstall of the programs.

What determines if an iOS app gets the new look in iOS 7

What exactly does iOS 7 use to determine whether the application should be displayed with the traditional iOS 6 style UI (aka iOS6 compatibility mode), or the newer iOS 7 UI?
If I build our app in Xcode 5, with base SDK set to 7 I get the iOS 7 UI as expected
If I build our app in Xcode 5, with base SDK set to 6 I still get the iOS 7 UI (unexpected, happens on real device and simulator)
If I build in Xcode 4.x, I get the older UI as expected
In all cases, the deployment target is set to 5.
Since our app has fairly custom UI we're not ready to move to the new look of iOS 7 yet. However we do need to make some backend changes to support iOS 7 which we need to release now. Can we still submit apps built with Xcode 4.x and expect them to be accepted?
For the time being, you are able to. Apple will make an announcement when they stop accepting apps built with Xcode 4.x. My company is currently submitting apps with Xcode 4.6 since we do not have a new enough operating system for 5. I suspect it will be at least a few months until they stop.
Running against 6.1 Base SDK should do it.
However, as I discovered yesterday. Anything less than 7.0 Base SDK isn't supported by Xcode 5 (officially) and so it is undefined behaviour.
My app suddenly switched from iOS6 UI to iOS7 UI with no code changes.
In the end I restarted my mac and phone, deleted the app, deleted derived data and reinstalled cocoapods and it was working on iOS6 UI again.
Make sure that you set the Base SDK to iOS 6 in both the Project build settings & the target build settings - that should do the trick. Even though the target settings are supposed to override the project, I found that when just the target was set to 6 - it compiled with 7.
Regarding XCode 5, it's true that it doesn't officially ship with the iOS 6 SDK. However, you can extract it from XCode 4.6 and use it in 5.
You'll find the SDK in the XCode app under:
Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Simply copy it from an existing installation of XCode 4.6 or from its .dmg (which can still be downloaded from Apple's website) to the corresponding folder in XCode 5, restart and you should now be able to select it as the Base SDK. Note that you'll have to do this after every update of XCode so you might find it easier to use a symbolic link rather than copying.
We've successfully submitted apps built this way to the App Store although as has been said before me, it would be a good idea to transition to iOS 7 ASAP before Apple makes it compulsory.

Is it possible to install iOS 6 SDK on Xcode 5?

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

Resources