Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 272 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to simultaneously satisfy constraints, will attempt to recover by breaking constraint

#1
Below is the error message I receive in the debug area. It runs fine and nothing is wrong except that I receive this error. Would this prevent apple accepting the app? How do I fix it?

2012-07-26 01:58:18.621 Rolo[33597:11303] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x887d630 h=--& v=--& V:[UIButtonLabel:0x886ed80(19)]>",
"<NSAutoresizingMaskLayoutConstraint:0x887d5f0 h=--& v=--& UIButtonLabel:0x886ed80.midY == + 37.5>",
"<NSAutoresizingMaskLayoutConstraint:0x887b4b0 h=--& v=--& V:[UIButtonLabel:0x72bb9b0(19)]>",
"<NSAutoresizingMaskLayoutConstraint:0x887b470 h=--& v=--& UIButtonLabel:0x72bb9b0.midY == - 0.5>",
"<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>",
"<NSLayoutConstraint:0x72c2430 UILabel:0x72bfad0.top == UILabel:0x72bf7c0.top>",
"<NSLayoutConstraint:0x72c2370 UILabel:0x72c0270.top == UILabel:0x72bfad0.top>",
"<NSLayoutConstraint:0x72c22b0 V:[UILabel:0x72bf7c0]-(NSSpace(8))-[UIButton:0x886efe0]>",
"<NSLayoutConstraint:0x72c15b0 V:[UILabel:0x72c0270]-(NSSpace(8))-[UIRoundedRectButton:0x72bbc10]>",
"<NSLayoutConstraint:0x72c1570 UIRoundedRectButton:0x72bbc10.baseline == UIRoundedRectButton:0x7571170.baseline>",
"<NSLayoutConstraint:0x72c21f0 UIRoundedRectButton:0x7571170.top == UIButton:0x886efe0.top>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Reply

#2
I had this issue because my `.xib` files were using autolayout.

In the file inspector, first tab. Unticking "Use Autolayout" solved the problem.

![autolayout file inspector][1]

[1]:
Reply

#3
**Be careful**, that you do not use more than one constraint in the same direction and type.

For example:
**Vertical constraint for trailing = 15 and another one is >= 10.**

Sometimes, Xcode creates **some constraints you don't notice**.
You have to **get rid of redundant constraints** and the log warning will surely disappear.

![enter image description here][1]

Additionaly, **you can read and detect** some certain reasons, directly **from the log**:

> NSLayoutConstraint:0xa338390 V:|-(15)-[UILabel:0xa331260] (Names:
> '|':UILabel:0xa330270 )>

This we can read as problem in UILabel constraint, it is leading vertical constraint being 15pt long.

> NSLayoutConstraint:0x859ab20 H:-(13)-|[UIView:0x85a8fb0]...

This would be trailing horizontal constraint etc.


[1]:
Reply

#4
The problem you're having is the NSAutoresizingMaskLayoutConstraints should not be in there. This is the old system of springs and struts. To get rid of it, run this method on each view that you're wanting to constrain:

[view setTranslatesAutoresizingMaskIntoConstraints:NO];

Reply

#5
Here is my experience and Solution.
I didn't touched code

1. Select view (UILabel, UIImage etc)
2. Editor > Pin > (Select...) to Superview
3. Editor > Resolve Auto Layout Issues > Add Missing Constraints
Reply

#6
I had quite a number of these exceptions thrown, the fastest and easiest way I found to solve them was to find unique values in the exceptions which I then searched for in the storyboard source code. This helped me to find the actual view(s) and constraint(s) causing the problem (I use meaningful userLabels on all of the views, which makes it a lot easier to track the constraints and views)...

So, using the above exceptions I would open the storyboard as "source code" in xcode (or another editor) and look for something I can find...

<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>
.. this looks like a vertical (V) constraint on a UILabel with a value of (17).

Looking through the exceptions I also find

<NSLayoutConstraint:0x72c22b0 V:[UILabel:0x72bf7c0]-(NSSpace(8))-[UIButton:0x886efe0]>

Which looks like the UILabel(0x72bf7c0) is close to a UIButton(0x886efe0) with some vertical spacing (8)..

That will hopefully be enough for me to find the specific views in the storyboard source code (probably by searching the text for "17" initially), or at least a few likely candidates. From there I should be able to actually figure out which views these are in the storyboard which will make it a lot easier to identify the problem (look for "duplicated" pinning or pinning that conflicts with size constraints).
Reply

#7
For me the main reason of this problem was that I forgot to uncheck `AutoLayout` in the `Xib` editor.
In fact, I did a lot of adjustments of the `XIB` in code.
Reply

#8
I have followed SO questions and answers from each search query. But they all are related with specific one.

At the basic, I mean before you are going to write down a format (may be a simple one) it will gives you a warnings.

From iOS 8.0 by default views are size classes. Even if you disable size classes it will still contains some auto layout constraints.

So if you are planning to set constrains via code using VFL. Then you must take care of one below line.

// Remove constraints if any.
[self.view removeConstraints:self.view.constraints];

I had search a lot in SO, but the solution was lies in [Apple Sample Code][1].

So you must have to remove default constraints before planning to add new one.

[1]:

[To see links please register here]

Reply

#9
I had a hard time figuring out what constraints were causing this error. Here is a simpler way to do it.

I'm using Xcode 6.1.1

1. "Command + A" to select all the UILabels, UIImages etc.
2. Click Editor -> Pin > (Select...) to Superview
3. again click Editor -> Resolve Auto Layout Issues -> Add Missing Constraints or Reset to Suggested Constraints. It depends on your case.
Reply

#10
for(UIView *view in [self.view subviews]) {
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
}

This helped me catch the view causing the problem.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through