Xcode Storyboard warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration
IosXcodeCocoa TouchStoryboardXcode6Ios Problem Overview
Ios Solutions
Solution 1 - Ios
This warning can be annoying and happens as of Xcode 6.1.1. The main problem is that you can not easily find the referenced constraint by clicking on the warning. I guess this is a bug and will get fixed sooner or later.
However, in the meantime you can use this little workaround:
Step 1: Detect annoying warning
Reveal in Log
Step 2: Right/Ctrl-Click on warning, select Step 3: Admire the beauty of the following log snippet:
... snip ...
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:Dlb-cb-nWC: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:6Ze-mO-v5N: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:9av-xw-u1o: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:RPt-Uf-vaZ: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:Rnc-4M-7jV: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:epJ-D9-KEF: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
/Devel/MyCrippledAppNG/MyCrippledApp/Main_iPad.storyboard:4HC-Gu-01w: warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration.
... snip ...
Hmmm... What's this...?
Step 4: Let's toss that into the project search bar...
Yep, you guessed right. Click it.
Step 5: OMG! Enjoy a few extra minutes of productivity until Apple fixes this annoying bug.
For 2016...
- If you can't get it with 'Reveal in Log', show the Report Navigator. (That is the rightmost tab on the leftmost column.) Delve into the build results there. That will show the build log, including the constraint ID. courtesy buildsucceeded
-
Note that for Xcode of 5/2016, annoyingly you have to quit and restart Xcode to clear this warning in some cases.
-
Note that confusingly, the same error can be caused by an unrelated problem (this appears to be an Apple bug or poor use of error language): if you have
IBInspectable
items, and happen to rename them in your Swift files. Xcode does not delete the old-name UserDefinedRuntimeAttributes for you. Simply click to "Identity Inspector" (item 3 on right panel) and delete the dud items.
For 2017...
-
Yet another common, and indeed simpler, cause of the problem. If you happened to un-Install an item: As of writing, very simply Xcode does not know to automatically also uninstall any constraints which lead to that item. Quite simply, look at any un-Installed items, and for all of its constraints, just mark them un-Installed. (Or simply, perhaps just temporarily delete the un-Installed item altogether, to see if that's the problem.)
Solution 2 - Ios
This message is triggered when you have deactivated a view in your storyboard, but didn't deactivate the constraints based on that view.
For example, you deactivated a button, but you still have some constraints linked to that button. It may be an intrinsic constraint like height or width, or a relative constraint like the distance from another view.
You have to turn off each of the constraints referencing the view, and you have to do it manually. Xcode is being overconservative here and won't do it for you.
Solution 3 - Ios
This solution works for me.
Because I copied several items from the project I developed in Xcode 5 into Xcode 6, and the storyboard in Xcode 6 supports multiple layouts, for every constraint, I need to install it in the current configuration.
For example, I am using "Compact Width | Regular Height", for the constraint I need to set like below:
After I checked and set all the hundreds of constraints in my projects, clean and build, the warnings finally disappear.
Solution 4 - Ios
Just wanted to add my case how this Error happened for me: In my case, I wanted to delete a Textfield with "Cmd+Backspace". I did this directly in the Scene-Builder Tree-View:
You can see that the snooze Field is grayed out.
So that was easily discovered for me. You can than simply really delete the Field by selecting:
Edit-Delete from the Menu
Surprisingly - this really deletes the field (including the constraints). Maybe this helps someone to easily find the cause of this annoying Warning...
Solution 5 - Ios
Expanded Explanation
Nothing wrong with the other answers. I just wanted to draw attention to the wording in the original warning and to identify a couple of use-cases where this can show up in one's workflow.
> Constraint referencing items turned off in current configuration.
Meaning that some item (usually a control or custom view that is normally visible) referenced in one or more constraints is turned off (disabled or has the checkbox "installed" unchecked). If for example you decide that you want to move a control or view in your storyboard outside of the main view (or you may see sometimes when doing something interesting in size classes) then you may see this warning if the control has constraints attached to it.
Along with the recommended solution:
> Turn off this constraint in the current configuration.
Two Approaches to Fix
Document Outline
Visually you can open the Document Outline in your storyboard and look for the grayed out Constraints that reference your control/view sitting outside of the main view (widen the outline, click the constraint, and view the attributes inspector, mouse down to review fast). Then remove the constraint from this context (size class). For example, in my case I am just holding the control until I decide later where to present it, so I chose to delete completely the offending constraint until later. But in a size class I would just uninstall the constraint from the current context using the installed checkbox in the attributes inspector.
Log Navigator/Find Tool
One can also continue to use the Log Navigator to find the problem control via the unique identifier given to each object on the storyboard. In the log it would be just before the yellow highlighted text and typically takes the form as seen in my example above: jvj-mY-DHf
Using the identifier one can then use the find tool in Xcode to locate and delete (completely) or uninstall (for the current context) the offending constraint.
If you're fond of Xml and its simplicity you can also just open up the Storyboard as Source Code and find the offending unique identifier and delete the appropriate block of xml.
Solution 6 - Ios
One of the reasons this could happen is because you selected a size class not compatible with your constraints (wAny hAny
is a common case). In such case, just select a different size class in Interface Builder and you are done.
Solution 7 - Ios
For me, it happens if I set an object a new contraint to object (not view) with "Constraint to margins" option not ticked. Problem solved with tick the option (which is default).
Solution 8 - Ios
What worked for me (and I have no idea why) is to turn "Use Trait Variations" off, then perform a clean, then turn them back on. The next build had no warnings.
To turn off "Use Trait Variations" simply select your storyboard in the Project Navigator and then select File Inspector.
Then just deselect "Use Trait Variations", perform clean by pressing Shift-CMD K, and then turn trait variations back on if you want to use them.
Solution 9 - Ios
I thought it was a persisting constraint due to the other answer, however it was due to an 'outlet' I still had for an item I deleted before. What to do is:
- Select your ViewController
- Click on the 'outlet' icon on the top right
- Look through your outlets and carefully delete any that you don't need
Worst case scenario you delete all your outlets and just hook them up again. Case solved!
Solution 10 - Ios
As mentioned and well guided in @BadCat's answer, I followed down the steps and just one more step I dared to take!
Steps to carry after last step of BadCats answer:
Step 1:
I selected the constraint in the Interface Builder and then keeping that on mind what it is it for and then deleted it.
Step 2
Build the XCode Project and it will show you may be the number of Warnings are increased. That's because you have deleted a constraint that it needs to compile well. So, go to 3rd Step!
Step 3
Re-add the constraint which you kept in mind(the one you deleted). And then re-build it again!
For Me the warnings went away just by doing this! I guess this will work out for some people!
Cause:
As I could understand the problem which caused to this warning was, I had a Label connected to an IBOutlet, but its name was starting with a capital letter. So I renamed it with a simple letter in the ViewController and came to change it in the IB. I removed past IBOutlet and went to connect it to the newly renamed property name and connected. Then I noticed there is a new warning come up.
First I tried the following answer too in this thread, but it didn't help!
Cheers!
Solution 11 - Ios
My case is choose label, then click control + X, it will be disable, but I don't do any thing with it. When I build, it will show warning. Solution: remove label or remove chosen control + X for label.
Solution 12 - Ios
I delete all those UI elements including their constraints, and add them all again, those warnings just disappear. Anyway this is a worst but useful way to solve this.
Solution 13 - Ios
I had the problem on a stack view. Deleting the constraints and re-adding them did not help. Cleaning and rebuilding did not help.
For me, the solution was to create a completely new stack view object.
Then move all elements from the old stack view into the new stack view.
Deleting the old stack view fixed the problem.
Solution 14 - Ios
For me, the problem was a constraint "Installed" for the "wR" view class that now needed to be "Installed" for all view classes:
Checking the general "Installed" box and unchecking the "Installed" box for "wR" made the constraint work properly:
But the warning still did not clear. It turns out you have to delete the "wR" option altogether by hitting the "X" to the left of it to make the warning go away: