Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Storyboard warning: Constraint referencing items turned off in current configuration. Turn off this constraint in the current configuration

This warning happens in Xcode 6.1. Anyone have ideas what does this warning mean and what will happen with it? Many thanks!

Below is a screenshot with the warnings opened in source code"

enter image description here

How to find which constraint causes the warning? Xcode does not tell you which constraint is the problem.

enter image description here

like image 736
Zhihao Yang Avatar asked Oct 09 '22 03:10

Zhihao Yang


1 Answers

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 😱

Annoying warning

Step 2: Right/Ctrl-Click on warning, select Reveal in Log 😨

enter image description here

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...?

interesting

Step 4: Let's toss that into the project search bar... 😐

search

😮 Yep, you guessed right. Click it.

Step 5: 😁 OMG! Enjoy a few extra minutes of productivity until Apple fixes this annoying bug. 😎

wheeee


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

enter image description here

enter image description here

  • 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.)
like image 199
BastiBen Avatar answered Oct 21 '22 12:10

BastiBen