My app has been supporting at least iOS6 using Xcode5.1 storyboard.
After I did several work in Xcode 6 GM, I need to test on iOS 6 Simulator.
Xcode 6 GM does not have iOS 6 Simulator.So, I opened my project in Xcode 5.1.
But It fails to build. I cannot even open the storyboard in Xcode5.1.
At the navigation pane, it says
Main_iPhone.storboard
Interface Builder Storyboard Compiler Error
The document"(null)" requires Xcode6.0 or later.
And when I click it, a prompt appears
The document "Main_iPhone.storyboard" requires Xcode 6.0 or later.
This version does not support constraints to layout margins. Open this document with Xcode 6.0 or later.
Adding almost any type of layout constraint with Xcode 6 will render a storyboard (or .xib file) incompatible with Xcode 5.1. If you need to work with a storyboard in Xcode 5.1 that has been modified with Xcode 6.0 it will be necessary to remove all "margin" based constraints.
Perform these steps to make a storyboard modified by Xcode 6 load and compile again with Xcode 5:
Using Xcode 6:
Set the "Opens in" to Xcode 5.1 in the Interface Builder Document Section of the storyboard File Inspector. When this is set, Xcode 6.0 will generate a warning if there are any incompatible margin constraints present.
One easy way to identify the margin constraints is to open the storyboard in a text editor (preferably one that auto refreshes when the file is changed on disk). Search for the word "Margin" and look for lines like this:
<constraint firstItem="gZc-ET-UKM" firstAttribute="leading" secondItem="MMQ-IT-qOo" secondAttribute="leadingMargin" constant="-8" id="H3i-wo-2Mm"/>
These constraints need to be either deleted or updated to be based directly on the superview rather than a margin. It is possible to update the constraint instead of deleting it by selecting the constraint in the outline view and then going to the Size Inspector and unchecking "Relative to margin" option in the drop down menu for the First Item or Second Item settings. Once you do that, you'll also need to add a constant that matches the margin (usually 8).
As you delete or update each constraint you should see the storyboard file in the text editor update and remove the word "Margin". Once you have deleted all of the incompatible constraints the warning will go away and this line will disappear from the storyboard file:
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
- If you deleted the constraints, the final step is to open the project in Xcode 5 and recreate them.
I encounter the same problem, and here is my solution:
Suppose the problem file is Main.storboard
- Using Xcode 6 open project;
- Select Main.storboard open as source code;
- Search "margin" in source code;
- Uncheck relative constraints' relative to margin in Interface Builder.
You can change this option in the identity inspector on right side.
Select your Storyboard in Xcode 6, open the identity inspector, then Interface Builder Document -> Opens in Xcode 5.1 (or something other)
select your nib file or storyboard, select file inspector pic 1. And uncheck use size classes (pic 2) in every storyboard, you created with xcode 6, because by default it checked.
Although, I don't think this is ultimate solution,
,for the time being I am writing, I just ignored that "RED ERROR" and hit the Run.
It launched iOS6 simulator and worked fine. All I had to is quitting the simulator launched by Xcode 6.
The error message is still there and I cannot open the storyboard file in Xcode 5.1.
but at least I am able to test it on the older version of iOS. So now Xcode5.1 is only for the testing, for my application :(
If you find better solution, anwwer the question. Thanks.