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

#11
use swift this code


view.translatesAutoresizingMaskIntoConstraints = false
Reply

#12
One thing to watch out for (at least this tripped me up) was that I was removing the constraint from the wrong view. The constraint I was trying to remove was not a child constraint of my view so when I did

myView.removeConstraint(theConstraint)

it wasn't actually removing anything because I needed to call

myView.superView.removeConstraint(theConstraint)

since the constraint was technically sibling constraint of my view.
Reply

#13
swift 4

I just add this line in viewDidLoad and work fine with me.

view.removeConstraints(view.constraints)
Reply

#14
None of the foregoing answers is helpful in my situation. I am running XCode 10.1 and testing my app on the simulator for an "iPad (5th generation)". The simulator is running iOS 12.1.

I've got a simple root view in my storyboard, with two UITextField subviews. There are no constraints being used in the storyboard at all. And I have no UIButtonBarView objects in the app or the storyboard.

No messages get printed when the app launches and lays the root view out. None when the simulated device is rotated.

But in the simulator, the moment I click on one of the text fields, the keyboard extension arises from the bottom of the screen, although not the full keyboard, which never seems to show up in the simulator. But the following is printed out on the terminal:

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:0x6000034e7700 h=--& v=--& UIKeyboardAssistantBar:0x7f9c7d714af0.height == 0 (active)>",
"<NSLayoutConstraint:0x6000034aba20 V:|-(0)-[_UIUCBKBSelectionBackground:0x7f9c7d51ec70] (active, names: '|':_UIButtonBarButton:0x7f9c7d51de40 )>",
"<NSLayoutConstraint:0x6000034aba70 _UIUCBKBSelectionBackground:0x7f9c7d51ec70.bottom == _UIButtonBarButton:0x7f9c7d51de40.bottom (active)>",
"<NSLayoutConstraint:0x6000034fb3e0 V:|-(0)-[_UIButtonBarStackView:0x7f9c7d715880] (active, names: '|':UIKeyboardAssistantBar:0x7f9c7d714af0 )>",
"<NSLayoutConstraint:0x6000034fb750 V:[_UIButtonBarStackView:0x7f9c7d715880]-(0)-| (active, names: '|':UIKeyboardAssistantBar:0x7f9c7d714af0 )>",
"<NSLayoutConstraint:0x6000034abc00 'UIButtonBar.maximumAlignmentSize' _UIButtonBarButton:0x7f9c7d51de40.height == UILayoutGuide:0x600002ef4e00'UIViewLayoutMarginsGuide'.height (active)>",
"<NSLayoutConstraint:0x6000034d7cf0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002ef4e00'UIViewLayoutMarginsGuide']-(9)-| (active, names: '|':_UIButtonBarStackView:0x7f9c7d715880 )>",
"<NSLayoutConstraint:0x6000034d7c50 'UIView-topMargin-guide-constraint' V:|-(10)-[UILayoutGuide:0x600002ef4e00'UIViewLayoutMarginsGuide'] (active, names: '|':_UIButtonBarStackView:0x7f9c7d715880 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000034aba70 _UIUCBKBSelectionBackground:0x7f9c7d51ec70.bottom == _UIButtonBarButton:0x7f9c7d51de40.bottom (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

It certainly appears to me that all this has to do with nothing in my app, and everything to do with how Apple is creating its own keyboard view, even with my small extension declared to be combined with it.

So the question remains, is there something I as an app developer am responsible for doing (on the presumption this is a bunch of stuff worth attending to) or is it just Apple's own problem/bug?

FWIW, this constraint problem message doesn't occur when simulating a newer iPad model, such as the iPad Pro 12.9-inch (3rd generation). But the message does show up when simulating an iPad Pro 9.7-inch". All claiming they're running iOS 12.1.
Reply

#15
I was also getting the same issue of breaking constraints in the log, for a viewCircle in the xib. I almost tried everything listed above and nothing was working for me.
Then I tried to change the priority of the Height constraint which was breaking in the log(confirmed by adding an identifiers for the constraints on the xib)[enter image description here][1]


[1]:
Reply

#16
I am getting this same error, but only on a specific view, when I touch the first textfield, and then the next textfield down.

I am writing in SwiftUI for iOS 13.4



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.
(
"<NSLayoutConstraint:0x2809b6760 'assistantHeight' TUISystemInputAssistantView:0x105710da0.height == 44 (active)>",
"<NSLayoutConstraint:0x2809ccff0 'assistantView.bottom' TUISystemInputAssistantView:0x105710da0.bottom == _UIKBCompatInputView:0x10525ae10.top (active)>",
"<NSLayoutConstraint:0x2809cccd0 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x105710da0] (active, names: '|':UIInputSetHostView:0x105215010 )>",
"<NSLayoutConstraint:0x2809ca300 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x10525ae10] (active, names: '|':UIInputSetHostView:0x105215010 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2809ccff0 'assistantView.bottom' TUISystemInputAssistantView:0x105710da0.bottom == _UIKBCompatInputView:0x10525ae10.top (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
Reply

#17
Basically, you just have to remove that constraint from the associated view. For instance, if is the height constraint giving warning, just remove it from your view; it will not affect the view.
Reply

#18
I would recommend to debug and find which constraint is **"the one you don't want"**. Suppose you have following issue:

![enter image description here][1]

**Always the problem is how to find following Constraints and Views.**

**There are two solutions how to do this:**

1. **DEBUG VIEW HIERARCHY** *(Do not recommend this way)*

Since you know where to find unexpected constraints (PBOUserWorkDayHeaderView) there is a way to do this fairly well. Let's find `UIView` and `NSLayoutConstraint` in red rectangles. Since we know their **id in memory** it is quite easy.

- Stop app using **Debug View Hierarchy**:

![enter image description here][2]

- Find the proper UIView:

![enter image description here][3]

- The next is to find NSLayoutConstraint we care about:

![enter image description here][4]


As you can see, the memory pointers are the same. So we know what is going on now. Additionally you can find `NSLayoutConstraint` in view hierarchy. Since it is selected in View, it selected in Navigator also.


![enter image description here][5]

If you need you may also print it on console using address pointer:

(lldb) po 0x17dce920
<UIView: 0x17dce920; frame = (10 30; 300 24.5); autoresize = RM+BM; layer = <CALayer: 0x17dce9b0>>


You can do the same for every constraint the debugger will point to you:-) Now you decide what to do with this.

2. **PRINT IT BETTER** *(I really recommend this way, this is of Xcode 7)*

- set unique identifier for every constraint in your view:

[![enter image description here][6]][6]

- create simple extension for `NSLayoutConstraint`:

**SWIFT**:

extension NSLayoutConstraint {

override public var description: String {
let id = identifier ?? ""
return "id: \(id), constant: \(constant)" //you may print whatever you want here
}
}

**OBJECTIVE-C**

@interface NSLayoutConstraint (Description)

@end

@implementation NSLayoutConstraint (Description)

-(NSString *)description {
return [NSString stringWithFormat:@"id: %@, constant: %f", self.identifier, self.constant];
}

@end

- build it once again, and now you have more readable output for you:

[![enter image description here][7]][7]

- once you got your `id` you can simple tap it in your **Find Navigator**:

[![enter image description here][8]][8]

- and quickly find it:

[![enter image description here][9]][9]


**HOW TO SIMPLE FIX THAT CASE?**

- try to change **priority** to `999` for broken constraint.


[1]:

[2]:

[3]:

[4]:

[5]:

[6]:

[7]:

[8]:

[9]:
Reply

#19
**Xcode runtime warning**

```
[LayoutConstraints] 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.
(
"<NSLayoutConstraint:0x600003235c70 'UISV-canvas-connection' V:[previousRoot]-(0)-| (active, names: stackRoot:0x7fe3f44e0780, previousRoot:0x7fe3f44e9c10, '|':stackRoot:0x7fe3f44e0780 )>",
"<NSLayoutConstraint:0x6000033cb660 'UISV-spacing' V:[serviceRoot]-(0)-[periodRoot] (active, names: periodRoot:0x7fe3f44ea920, serviceRoot:0x7fe3f44e7db0 )>",
...
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600003356080 serviceImageView.height == 32 (active, names: serviceImageView:0x7fe3f44e8190 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
```

Currently(at least Xcode v14.2) it is simple to use **Debug View Hierarchy**

- Start Debug View Hierarchy
- Show the Debug navigator
- Filter by address

<img src="https://i.stack.imgur.com/MAGE2.png" height="150">

Here you can simply select and review constraints

Some notes:
- Use `Editor -> Show Clipped Content`[<sup>\[About\]</sup>][1]
- `UIStackView`(UISV) constraints or some other cases can be fixed by putting UIStackView/view into container with one of constraint(e.g. bottom) with **priority** 999


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

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