LayoutConstraints - Unable to simultaneously satisfy constraints - ios

I have an app, when I click on my profile page, I kept getting these errors in my console
I have tried
This is the entire constraint that I have on my profile page
I kept getting
john
jane
andrew
2018-07-31 11:58:46.821640-0400 tableInTabbed[4355:5682078] [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:0x604000281130 UIImageView:0x7ff91cf1d030.width == 70 (active)>",
"<NSLayoutConstraint:0x6040002812c0 UIImageView:0x7ff91cf1d030.width == UIImageView:0x7ff91cf1d030.height (active)>",
"<NSLayoutConstraint:0x604000280d20 UITableViewCellContentView:0x7ff91cf1c7f0.bottomMargin == UIImageView:0x7ff91cf1d030.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x6040002815e0 UIImageView:0x7ff91cf1d030.top == UITableViewCellContentView:0x7ff91cf1c7f0.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x60c000290040 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cf1c7f0.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6040002812c0 UIImageView:0x7ff91cf1d030.width == UIImageView:0x7ff91cf1d030.height (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-31 11:58:46.822304-0400 tableInTabbed[4355:5682078] [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:0x604000280d20 UITableViewCellContentView:0x7ff91cf1c7f0.bottomMargin == UIImageView:0x7ff91cf1d030.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x6040002815e0 UIImageView:0x7ff91cf1d030.top == UITableViewCellContentView:0x7ff91cf1c7f0.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x604000281310 UIImageView:0x7ff91cf1d030.height == 70 (active)>",
"<NSLayoutConstraint:0x60c000290040 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cf1c7f0.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x604000281310 UIImageView:0x7ff91cf1d030.height == 70 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-31 11:58:46.822846-0400 tableInTabbed[4355:5682078] [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:0x60c00028fa00 UIImageView:0x7ff91cc140c0.width == 70 (active)>",
"<NSLayoutConstraint:0x60c00028ff00 UIImageView:0x7ff91cc140c0.width == UIImageView:0x7ff91cc140c0.height (active)>",
"<NSLayoutConstraint:0x60c00028a8c0 UITableViewCellContentView:0x7ff91cc13cb0.bottomMargin == UIImageView:0x7ff91cc140c0.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x60c000289b50 UIImageView:0x7ff91cc140c0.top == UITableViewCellContentView:0x7ff91cc13cb0.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x60c000290900 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cc13cb0.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60c00028ff00 UIImageView:0x7ff91cc140c0.width == UIImageView:0x7ff91cc140c0.height (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-31 11:58:46.823293-0400 tableInTabbed[4355:5682078] [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:0x60c00028a8c0 UITableViewCellContentView:0x7ff91cc13cb0.bottomMargin == UIImageView:0x7ff91cc140c0.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x60c000289b50 UIImageView:0x7ff91cc140c0.top == UITableViewCellContentView:0x7ff91cc13cb0.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x60c00028fb90 UIImageView:0x7ff91cc140c0.height == 70 (active)>",
"<NSLayoutConstraint:0x60c000290900 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cc13cb0.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60c00028fb90 UIImageView:0x7ff91cc140c0.height == 70 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-31 11:58:46.823961-0400 tableInTabbed[4355:5682078] [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:0x60c000290ae0 UIImageView:0x7ff91cc16a40.width == 70 (active)>",
"<NSLayoutConstraint:0x60c000290b30 UIImageView:0x7ff91cc16a40.width == UIImageView:0x7ff91cc16a40.height (active)>",
"<NSLayoutConstraint:0x60c000290cc0 UITableViewCellContentView:0x7ff91cc16840.bottomMargin == UIImageView:0x7ff91cc16a40.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x60c000290d60 UIImageView:0x7ff91cc16a40.top == UITableViewCellContentView:0x7ff91cc16840.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x6040002822b0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cc16840.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60c000290b30 UIImageView:0x7ff91cc16a40.width == UIImageView:0x7ff91cc16a40.height (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-31 11:58:46.824333-0400 tableInTabbed[4355:5682078] [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:0x60c000290cc0 UITableViewCellContentView:0x7ff91cc16840.bottomMargin == UIImageView:0x7ff91cc16a40.bottom + 52.67 (active)>",
"<NSLayoutConstraint:0x60c000290d60 UIImageView:0x7ff91cc16a40.top == UITableViewCellContentView:0x7ff91cc16840.topMargin + 29.33 (active)>",
"<NSLayoutConstraint:0x60c000290b80 UIImageView:0x7ff91cc16a40.height == 70 (active)>",
"<NSLayoutConstraint:0x6040002822b0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7ff91cc16840.height == 168 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60c000290b80 UIImageView:0x7ff91cc16a40.height == 70 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
This is what I have
//
// ProfileViewController
// tableInTabbed
//
// Copyright © 2018 LR Web Design. All rights reserved.
//
import UIKit
class ProfileViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let profiles = ["john", "jane", "andrew"]
let devicesInProfile = ["3", "5", "10"]
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return (profiles.count)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! ViewControllerTableViewCell
cell.profileImg.image = UIImage(named: profiles[indexPath.row] + ".jpg")
cell.profileName.text = profiles[indexPath.row]
print(profiles[indexPath.row])
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
I just want to get rid of the error message.
Update
#Sandeep, after trying your answer, I ended up with this final constraint
This is the result
Can you please suggest a bit more ?

Step 1:
Drag a View to your cell and apply horizontally and vertically center constraints to to your view (This will show few constraint breaks but hang on a bit)
Step 2:
Drag imageView to view and apply height constraint/ aspect ratio/ leading / height and bottom constraint as shown
Step 3:
Drag UILabel to View preferably right side of ImageView and apply trailing constraint and leading constraint to label. Leading constraint will be to content view of cell while leading constraint to UIImageView.
Trailing Constraint to Label
Now add Leading constraint to UIImageView (Control drag from label to imageView and select horizontal spacing)
Finally control drag from label to imageView again and select center vertically
That should be it :)
If everything is fine final constraints should look like
Hope this helps

What have you did in your code seems to be fine, but it has nothing to do with what have you seen in the console.
First, you should know that red constraints means that there is something wrong, more specifically it means that the interface builder is unable to recognize what to achieve because there is at least one constraint missed (and that's why you are seeing these complains on the console).
Therefore, I would highly recommend to avoid following the approach of "Adding Missing Constraints" or "Reset to Suggested Constraints", it is not an elegant option to deal with constraints; Most of the time, even if they didn't add red (missing) constraints, it won't leads to the expected result, which seems to be logical because it can't be so magical to read your mind thoughts and translate it, they could be more than just one aspect for determining the way of how to setup the constraints! Instead, do it by your self, that's the good approach for achieving what's exactly it should look/behave. Keep in mind that it is not just one static way to do it, after getting understanding the that Auto Layout works you figure that there is more than one way to achieve it.
In general, the expected result is to see blue lines (constraints) instead of red or orange.
Now, because it might be broad to describe how to setup your constraints (Auto Layout), I would suggest to check: Understanding Auto Layout from Apple, it is a very good place to start with.

1- Make sure that only one path of elements from top to bottom is hooked to the contentView , if you see red lines , disconnect bottom constraint and change middle items constraints , then re-hook it again
2- Set bottom most constraint priority to 999
3- Set leading to the imageView and only the bottom - most element should be hooked to the contentView's bottom
//
Blue lines here should only be constraints with img width&height
//
Set this in viewDidLoad
tableView.estimatedRowHeight = 200;
tableView.rowHeight = UITableViewAutomaticDimension;

Related

DatePicker with graphical style breaks layout constraints on iOS 16.0

The following code breaks the layout constraints when running on Xcode-14.0.0-Beta 5 with iOS 16.0
struct ContentView: View {
#State var date = Date()
var body: some View {
DatePicker(selection: $date, displayedComponents: .date, label: { EmptyView() })
.datePickerStyle(.graphical)
}
}
Any suggestions how to fix or hide the warning?
Console warning:
2022-08-24 17:16:40.471325+0300 DatePickerProblem[77364:483284] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x600003559180 h=--& v=--& _UIDatePickerCalendarTimeView:0x7fe15c322520.height == 0 (active)>",
"<NSLayoutConstraint:0x60000352bca0 _UIDatePickerCompactTimeLabel:0x7fe15c322bc0.centerY == _UIDatePickerCalendarTimeView:0x7fe15c322520.centerY - 1 (active)>",
"<NSLayoutConstraint:0x60000352bcf0 V:|-(>=0)-[_UIDatePickerCompactTimeLabel:0x7fe15c322bc0] (active, names: '|':_UIDatePickerCalendarTimeView:0x7fe15c322520 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000352bca0 _UIDatePickerCompactTimeLabel:0x7fe15c322bc0.centerY == _UIDatePickerCalendarTimeView:0x7fe15c322520.centerY - 1 (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.
2022-08-24 17:16:40.471971+0300 DatePickerProblem[77364:483284] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x600003559180 h=--& v=--& _UIDatePickerCalendarTimeView:0x7fe15c322520.height == 0 (active)>",
"<NSLayoutConstraint:0x60000352bd40 UILabel:0x7fe15c324d00.centerY == _UIDatePickerCalendarTimeView:0x7fe15c322520.centerY - 1 (active)>",
"<NSLayoutConstraint:0x60000352bd90 V:|-(>=0)-[UILabel:0x7fe15c324d00] (active, names: '|':_UIDatePickerCalendarTimeView:0x7fe15c322520 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000352bd40 UILabel:0x7fe15c324d00.centerY == _UIDatePickerCalendarTimeView:0x7fe15c322520.centerY - 1 (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.
2022-08-24 17:16:40.478778+0300 DatePickerProblem[77364:483284] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<_UISystemBaselineConstraint:0x60000355c190 H:[UILabel:0x7fe15c324d00]-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerCompactTimeLabel:0x7fe15c322bc0] (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x6000035590e0 h=--& v=--& _UIDatePickerCalendarTimeView:0x7fe15c322520.width == 0 (active)>",
"<NSLayoutConstraint:0x60000352bf20 UILabel:0x7fe15c324d00.leading == UILayoutGuide:0x600002f06760'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x60000355c230 _UIDatePickerCompactTimeLabel:0x7fe15c322bc0.trailing == UILayoutGuide:0x600002f06760'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x60000352be30 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x600002f06760'UIViewLayoutMarginsGuide' (active, names: '|':_UIDatePickerCalendarTimeView:0x7fe15c322520 )>",
"<NSLayoutConstraint:0x60000352bed0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600002f06760'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: '|':_UIDatePickerCalendarTimeView:0x7fe15c322520 )>"
)
Will attempt to recover by breaking constraint
<_UISystemBaselineConstraint:0x60000355c190 H:[UILabel:0x7fe15c324d00]-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerCompactTimeLabel:0x7fe15c322bc0] (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.
2022-08-24 17:16:40.512015+0300 DatePickerProblem[77364:483284] [UICalendarView] UICalendarView's height is smaller than it can render its content in; defaulting to the minimum height.
2022-08-24 17:16:40.548888+0300 DatePickerProblem[77364:483284] [UICalendarView] UICalendarView's height is smaller than it can render its content in; defaulting to the minimum height.
It seems that the new underlying UICalendarView has some AutoLayout Issues when used by its SwiftUI DatePicker wrapper.
You can see this even better, when you enable the Time Component too (displayedComponents: [.date, .hourAndMinute]). This gives a much longer Auto-Layout warning about the time label constraint being broken.
For me this happens especially when the SwiftUI View is embedded using an UIHostingController which is pushed onto a Navigation Stack.
In my case, I was able to fix it by giving the DatePicker its default width as its frame width:
struct ContentView: View {
#State var date = Date()
var body: some View {
DatePicker(
selection: $date,
displayedComponents: [.date, .hourAndMinute],
label: { EmptyView() }
)
.datePickerStyle(.graphical)
.frame(width: 320) // Bugfix for AutoLayout-Issue
}
}

Using UIScreen width property is breaking constraint of UITableViewCell

I am trying to constraint UITableViewCell programmatically. My cell consists of a simple pager. My init method of cell includes following.
height = UIScreen.main.bounds.width * 0.56 // If I use static i.e 320 value it is ok.
width = UIScreen.main.bounds.width is ok.
pagerView.topAnchor.constrain(to: topAnchor)
pagerView.bottomAnchor.constrain(to: bottomAnchor)
pagerView.widthAnchor.constrain(to: width)
pagerView.heightAnchor.constrain(to: height)
When I try to constraint using UIScreen.main.bounds.width it gives me following error. However, if I use static 320 value instead of UIScreen width it is all good.
> 2020-02-25 16:07:44.209043+0300 myApp[23049:780168]
> [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:0x6000035345f0 V:|-(0)-[FSPagerView.FSPagerView:0x7fb96c6226f0] (active, names:
> '|':myApp.HomePagerCell:0x7fb96e041c00'HomePagerCell' )>",
> "<NSLayoutConstraint:0x6000035346e0 FSPagerView.FSPagerView:0x7fb96c6226f0.bottom ==
> myApp.HomePagerCell:0x7fb96e041c00'HomePagerCell'.bottom (active)>",
> "<NSLayoutConstraint:0x600003534780 FSPagerView.FSPagerView:0x7fb96c6226f0.height == 231.84 (active)>",
> "<NSLayoutConstraint:0x600003534aa0 'UIView-Encapsulated-Layout-Height'
> myApp.HomePagerCell:0x7fb96e041c00'HomePagerCell'.height == 232
> (active)>" ) Will attempt to recover by breaking constraint
> <NSLayoutConstraint:0x600003534780
> FSPagerView.FSPagerView:0x7fb96c6226f0.height == 231.84 (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.
What could be the reason of it and how can I solve it?

stackview constraints break when adding two views inside with imageview having fixed width and height [duplicate]

This question already has answers here:
Strange UIView-Encapsulated-Layout-Height Error
(11 answers)
Closed 2 days ago.
i have a stackview with an imageview and a label underneath it but when i try to add it into stackview it doesnt appear and apparently all the constraints break.i want the imageview to be fixed width and height and the stackview to equal the width of the label
let userView_stackView = UIStackView()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
userView_stackView.axis = .vertical
userView_stackView.alignment = .center
userView_stackView.spacing = 5
userView_stackView.addArrangedSubview(user_imageView)
userView_stackView.addArrangedSubview(user_name)
self.contentView.addSubview(userView_stackView)
stackView_constraints()
}
var user_imageView: UIImageView = {
let imageView = UIImageView()
let imageViewHeightAndWidth: CGFloat = 60
let image = UIImage(named: "steve")
imageView.image = image
imageView.layer.borderWidth = 1
imageView.clipsToBounds = true
imageView.layer.borderColor = UIColor.white.cgColor
imageView.layer.cornerRadius = imageViewHeightAndWidth / 2
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.heightAnchor.constraint(equalToConstant: imageViewHeightAndWidth).isActive = true
imageView.widthAnchor.constraint(equalToConstant: imageViewHeightAndWidth).isActive = true
return imageView
}()
var user_name: UILabel = {
let label = UILabel()
label.text = "Steve Rodriquez"
label.font = label.font.withSize(14)
return label
}()
func stackView_constraints() {
userView_stackView.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: 0).isActive =
true
userView_stackView.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: 0)
.isActive = true
userView_stackView.trailingAnchor.constraint(
equalTo: self.contentView.trailingAnchor, constant: 0
).isActive = true
userView_stackView.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor, constant: 0)
.isActive = true
}
Adding views like this breaks the constraints and prints the following error on the console where all the constraints are breaking
[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:0x280d70eb0 UIStackView:0x10327c250.height == 283 (active)>",
"<NSLayoutConstraint:0x280d72580 'UIView-Encapsulated-Layout-Height' UIStackView:0x10327c250.height == 0 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280d70eb0 UIStackView:0x10327c250.height == 283 (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.
2019-10-12 10:43:30.597559-0500 Fourmi[1708:291157] [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:0x280d5f610 UIImageView:0x10327c6d0.width == 60 (active)>",
"<NSLayoutConstraint:0x280d72c10 'UISV-canvas-connection' UIStackView:0x10327c250.leading == _UILayoutSpacer:0x281174960'UISV-alignment-spanner'.leading (active)>",
"<NSLayoutConstraint:0x280d73020 'UISV-canvas-connection' UIStackView:0x10327c250.centerX == UIImageView:0x10327c6d0.centerX (active)>",
"<NSLayoutConstraint:0x280d72d50 'UISV-spanning-boundary' _UILayoutSpacer:0x281174960'UISV-alignment-spanner'.leading <= UIImageView:0x10327c6d0.leading (active)>",
"<NSLayoutConstraint:0x280d72300 'UIView-Encapsulated-Layout-Width' UIStackView:0x10327c250.width == 0 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280d5f610 UIImageView:0x10327c6d0.width == 60 (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.
2019-10-12 10:43:30.598068-0500 Fourmi[1708:291157] [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:0x280d5f5c0 UIImageView:0x10327c6d0.height == 60 (active)>",
"<NSLayoutConstraint:0x280d72b70 'UISV-canvas-connection' UIStackView:0x10327c250.top == UIImageView:0x10327c6d0.top (active)>",
"<NSLayoutConstraint:0x280d72bc0 'UISV-canvas-connection' V:[UILabel:0x10327e990'Steve Rodriquez']-(0)-| (active, names: '|':UIStackView:0x10327c250 )>",
"<NSLayoutConstraint:0x280d72c60 'UISV-spacing' V:[UIImageView:0x10327c6d0]-(5)-[UILabel:0x10327e990'Steve Rodriquez'] (active)>",
"<NSLayoutConstraint:0x280d72580 'UIView-Encapsulated-Layout-Height' UIStackView:0x10327c250.height == 0 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280d5f5c0 UIImageView:0x10327c6d0.height == 60 (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.
2019-10-12 10:43:30.598469-0500 Fourmi[1708:291157] [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:0x280d72b70 'UISV-canvas-connection' UIStackView:0x10327c250.top == UIImageView:0x10327c6d0.top (active)>",
"<NSLayoutConstraint:0x280d72bc0 'UISV-canvas-connection' V:[UILabel:0x10327e990'Steve Rodriquez']-(0)-| (active, names: '|':UIStackView:0x10327c250 )>",
"<NSLayoutConstraint:0x280d72c60 'UISV-spacing' V:[UIImageView:0x10327c6d0]-(5)-[UILabel:0x10327e990'Steve Rodriquez'] (active)>",
"<NSLayoutConstraint:0x280d72580 'UIView-Encapsulated-Layout-Height' UIStackView:0x10327c250.height == 0 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280d72c60 'UISV-spacing' V:[UIImageView:0x10327c6d0]-(5)-[UILabel:0x10327e990'Steve Rodriquez'] (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.
2019-10-12 10:43:30.598894-0500 Fourmi[1708:291157] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x280d40000 h=--& v=--& UIStackView:0x10327c250.width == 0 (active)>",
"<NSLayoutConstraint:0x280d5ff20 UIStackView:0x10327c250.width == UITableViewCellContentView:0x10327fdb0.width (active)>",
"<NSLayoutConstraint:0x280d40370 'fittingSizeHTarget' UITableViewCellContentView:0x10327fdb0.width == 375 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280d5ff20 UIStackView:0x10327c250.width == UITableViewCellContentView:0x10327fdb0.width (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.
2019-10-12 10:43:30.599762-0500 Fourmi[1708:291157] [Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a table view cell's content view. We're considering the collapse unintentional and using standard height instead. Cell: <Fourmi.ChatTableViewCell: 0x10327af70; baseClass = UITableViewCell; frame = (0 0; 375 44); autoresize = W; layer = <CALayer: 0x282e41300>>
adding userView_stackView.translatesAutoresizingMaskIntoConstraints=falsefixed it

Autolayout warning when using prompt in navigation bar

I am using a navigation bar with a prompt, looking like this:
I receive the following auto layout warnings in the console:
2019-09-01 21:26:03.225576+0200 Hortus[85622:2386450] [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:0x600002d16990 UILabel:0x7fc9eb816f50'Testen'.centerX == _UINavigationBarModernPromptView:0x7fc9ebe27780.centerX (active)>",
"<NSLayoutConstraint:0x600002d15c20 UILabel:0x7fc9eb816f50'Testen'.leading >= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600002d10ff0 '_UITemporaryLayoutWidth' _UINavigationBarModernPromptView:0x7fc9ebe27780.width == 0 (active)>",
"<NSLayoutConstraint:0x600002d16a30 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fc9ebe27780 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002d15c20 UILabel:0x7fc9eb816f50'Testen'.leading >= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.leading (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.
2019-09-01 21:26:03.226198+0200 Hortus[85622:2386450] [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:0x600002d16990 UILabel:0x7fc9eb816f50'Testen'.centerX == _UINavigationBarModernPromptView:0x7fc9ebe27780.centerX (active)>",
"<NSLayoutConstraint:0x600002d15540 UILabel:0x7fc9eb816f50'Testen'.trailing <= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x600002d10ff0 '_UITemporaryLayoutWidth' _UINavigationBarModernPromptView:0x7fc9ebe27780.width == 0 (active)>",
"<NSLayoutConstraint:0x600002d14320 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fc9ebe27780 )>"
"<NSAutoresizingMaskLayoutConstraint:0x60000043be30 h=--& v=--& _UINavigationBarModernPromptView:0x7fb3c6416640.width == 0 (active)>",
"<NSLayoutConstraint:0x600000421400 UILabel:0x7fb3c66d8bf0'Plant guide'.centerX == _UINavigationBarModernPromptView:0x7fb3c6416640.centerX (active)>",
"<NSLayoutConstraint:0x600000421f90 UILabel:0x7fb3c66d8bf0'Plant guide'.trailing <= UILayoutGuide:0x600001e58fc0'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x600000421e00 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600001e58fc0'UIViewLayoutMarginsGuide']-(20)-|(LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fb3c6416640 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002d15540 UILabel:0x7fc9eb816f50'Testen'.trailing <= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.trailing (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.
These warnings are given for the prompt in the navigation bar, but I do not set the autolayout constraints for the navigation bar. This should be handled by IOS itself.
What can I do to fix these warnings?
[Edit] The warnings are given in prepare() when segueing to the view controller. I set the prompt in prepare(). The segue is to a storyboard reference and is defined as 'present modally'. The storyboard reference references a UINavigationController. The prompt is set on the root view controller of the navigation controller.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let identifier = segue.identifier {
switch identifier {
case "editImage":
let nc = segue.destination as? TTImageNavigationController
if let rvc = nc?.rootViewController as? TTImageEditorController {
rvc.navigationItem.prompt = navigationItem.prompt
}
default:
break
}
}
}
[EDIT] It seems that the problem is not clear to most of the people who react. Again... I do not set any auto layout settings in code or storyboard. The problem occurs in the navigation bar after setting the prompt in the prepare() function prior to the segue. The code is given above. Any reactions that say that I have to change or check my constraints are not helpful, because there are no constraints to check!
[EDIT] As requested by Mohsen, I created a small sample project on github: https://bitbucket.org/Leontien/navigationbarautolayoutwarning/src/master/
It’s not your bug. It’s Apple’s bug. Ignore the console. File a report with Apple and move on.
Set priority to your constraints. This will fulfill constraints according to priority. Please refer this link.
you set centerX for the label and set leading and trailing for right and left buttons, also you didn't set any width constraint for UILabel
"<NSLayoutConstraint:0x600002d16990 UILabel:0x7fc9eb816f50'Testen'.centerX == _UINavigationBarModernPromptView:0x7fc9ebe27780.centerX (active)>",
"<NSLayoutConstraint:0x600002d15c20 UILabel:0x7fc9eb816f50'Testen'.leading >= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600002d10ff0 '_UITemporaryLayoutWidth' _UINavigationBarModernPromptView:0x7fc9ebe27780.width == 0 (active)>",
"<NSLayoutConstraint:0x600002d16a30 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fc9ebe27780 )>"
.
"<NSLayoutConstraint:0x600002d16990 UILabel:0x7fc9eb816f50'Testen'.centerX == _UINavigationBarModernPromptView:0x7fc9ebe27780.centerX (active)>",
"<NSLayoutConstraint:0x600002d15540 UILabel:0x7fc9eb816f50'Testen'.trailing <= UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x600002d10ff0 '_UITemporaryLayoutWidth' _UINavigationBarModernPromptView:0x7fc9ebe27780.width == 0 (active)>",
"<NSLayoutConstraint:0x600002d14320 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000037571e0'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fc9ebe27780 )>"
"<NSAutoresizingMaskLayoutConstraint:0x60000043be30 h=--& v=--& _UINavigationBarModernPromptView:0x7fb3c6416640.width == 0 (active)>",
"<NSLayoutConstraint:0x600000421400 UILabel:0x7fb3c66d8bf0'Plant guide'.centerX == _UINavigationBarModernPromptView:0x7fb3c6416640.centerX (active)>",
"<NSLayoutConstraint:0x600000421f90 UILabel:0x7fb3c66d8bf0'Plant guide'.trailing <= UILayoutGuide:0x600001e58fc0'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x600000421e00 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600001e58fc0'UIViewLayoutMarginsGuide']-(20)-|(LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7fb3c6416640 )>"
for solve this warning you should remove leading and trailing constraint from UILabel and set left button with leading to superview and right button's trailing to superview as well.
or you can use a navigation bar object, it has a label and also you can add barButtonItem to it.
you can add width constraint for the UILabel but it will be conflict on another devices when you run it on some other devices
This helps to debug broken constraint issue by providing a more readable output
Create an extension for NSLayoutConstraint
extension NSLayoutConstraint {
override open var description: String {
let id = identifier ?? ""
return "Constraint ID: \(id), constant: \(constant)"
}
}
set a unique identifier for every constraint in the storyboard
you'll get a more readable output pointing out which constraint id is broken
change the priority for broken constraint

How to set layout constraint for AVPlayerViewController?

I have set AVPlayerViewController.How to set layout constraint for AVPlayerViewController? Thanks!
start APP console displayer this warning:
2017-04-14 10:51:34.900747 robot_blue[12510:4193750] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x174482170 _UIBackdropContentView:0x101fb3e60.width == _UIBackdropView:0x101fb2990.width>",
"<NSLayoutConstraint:0x17048a8c0 UILabel:0x101fc9b00.leading == _UIBackdropContentView:0x101fb3e60.leading + 14>",
"<NSLayoutConstraint:0x17048a910 _UIBackdropContentView:0x101fb3e60.trailing == UILabel:0x101fc9b00.trailing + 14>",
"<NSLayoutConstraint:0x17048a5a0 _UIBackdropView:0x101fb2990.leading == UIView:0x101fb27f0.leading>",
"<NSLayoutConstraint:0x17048a5f0 UIView:0x101fb27f0.trailing == _UIBackdropView:0x101fb2990.trailing>",
"<NSLayoutConstraint:0x17048a410 UIView:0x101fb27f0.leading == AVAlphaUpdatingView:0x101fb2450.leading>",
"<NSLayoutConstraint:0x17048a460 AVAlphaUpdatingView:0x101fb2450.trailing == UIView:0x101fb27f0.trailing>",
"<NSLayoutConstraint:0x174482260 AVAlphaUpdatingView:0x101fb2450.width == 0>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17048a910 _UIBackdropContentView:0x101fb3e60.trailing == UILabel:0x101fc9b00.trailing + 14>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-04-14 10:51:34.901441 robot_blue[12510:4193750] [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:0x17048a4b0 UIView:0x101fb27f0.top >= AVAlphaUpdatingView:0x101fb2450.top>",
"<NSLayoutConstraint:0x17048a500 AVAlphaUpdatingView:0x101fb2450.bottom == UIView:0x101fb27f0.bottom>",
"<NSLayoutConstraint:0x17048a550 UIView:0x101fb27f0.height == 44>",
"<NSLayoutConstraint:0x174481bd0 AVAlphaUpdatingView:0x101fb2450.height == 0>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17048a500 AVAlphaUpdatingView:0x101fb2450.bottom == UIView:0x101fb27f0.bottom>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-04-14 10:51:34.902242 robot_blue[12510:4193750] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x174482170 _UIBackdropContentView:0x101fb3e60.width == _UIBackdropView:0x101fb2990.width>",
"<NSLayoutConstraint:0x17048a6e0 UIView:0x101fb3b20.leading == _UIBackdropContentView:0x101fb3e60.leading>",
"<NSLayoutConstraint:0x17048a730 _UIBackdropContentView:0x101fb3e60.trailing == UIView:0x101fb3b20.trailing>",
"<NSLayoutConstraint:0x17048a5a0 _UIBackdropView:0x101fb2990.leading == UIView:0x101fb27f0.leading>",
"<NSLayoutConstraint:0x17048a5f0 UIView:0x101fb27f0.trailing == _UIBackdropView:0x101fb2990.trailing>",
"<NSLayoutConstraint:0x17048a410 UIView:0x101fb27f0.leading == AVAlphaUpdatingView:0x101fb2450.leading>",
"<NSLayoutConstraint:0x17048a460 AVAlphaUpdatingView:0x101fb2450.trailing == UIView:0x101fb27f0.trailing>",
"<NSLayoutConstraint:0x174482440 AVButton:0x101fb2e50.left == UIView:0x101fb3b20.left + 14>",
"<NSLayoutConstraint:0x1744824e0 UILabel:0x101fb4000.left == AVButton:0x101fb2e50.right + 15>",
"<NSLayoutConstraint:0x174482580 AVScrubber:0x101fc6900.left == UILabel:0x101fb4000.right + 12>",
"<NSLayoutConstraint:0x1744825d0 AVScrubber:0x101fc6900.right == UILabel:0x1020d1280.left - 12>",
"<NSLayoutConstraint:0x1744826c0 UILabel:0x1020d1280.right == AVButton:0x1020d1510.left - 15>",
"<NSLayoutConstraint:0x174482760 AVButton:0x1020d1510.right == AVButton:0x1020d1a30.left - 10>",
"<NSLayoutConstraint:0x174482670 AVButton:0x1020d1a30.right == AVButton:0x1020d22a0.left - 10>",
"<NSLayoutConstraint:0x174482850 AVButton:0x1020d22a0.right == UIView:0x101fb3b20.right - 14>",
"<NSLayoutConstraint:0x174482260 AVAlphaUpdatingView:0x101fb2450.width == 0>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1744824e0 UILabel:0x101fb4000.left == AVButton:0x101fb2e50.right + 15>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-04-14 10:51:34.903110 robot_blue[12510:4193750] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x174482170 _UIBackdropContentView:0x101fb3e60.width == _UIBackdropView:0x101fb2990.width>",
"<NSLayoutConstraint:0x17048a6e0 UIView:0x101fb3b20.leading == _UIBackdropContentView:0x101fb3e60.leading>",
"<NSLayoutConstraint:0x17048a730 _UIBackdropContentView:0x101fb3e60.trailing == UIView:0x101fb3b20.trailing>",
"<NSLayoutConstraint:0x17048a5a0 _UIBackdropView:0x101fb2990.leading == UIView:0x101fb27f0.leading>",
"<NSLayoutConstraint:0x17048a5f0 UIView:0x101fb27f0.trailing == _UIBackdropView:0x101fb2990.trailing>",
"<NSLayoutConstraint:0x17048a410 UIView:0x101fb27f0.leading == AVAlphaUpdatingView:0x101fb2450.leading>",
"<NSLayoutConstraint:0x17048a460 AVAlphaUpdatingView:0x101fb2450.trailing == UIView:0x101fb27f0.trailing>",
"<NSLayoutConstraint:0x174482440 AVButton:0x101fb2e50.left == UIView:0x101fb3b20.left + 14>",
"<NSLayoutConstraint:0x174482760 AVButton:0x1020d1510.right == AVButton:0x1020d1a30.left - 10>",
"<NSLayoutConstraint:0x174482670 AVButton:0x1020d1a30.right == AVButton:0x1020d22a0.left - 10>",
"<NSLayoutConstraint:0x174482850 AVButton:0x1020d22a0.right == UIView:0x101fb3b20.right - 14>",
"<NSLayoutConstraint:0x174482a80 AVLoadingIndicatorView:0x101fc8c80.left >= AVButton:0x101fb2e50.right + 15>",
"<NSLayoutConstraint:0x174482ad0 AVLoadingIndicatorView:0x101fc8c80.right <= AVButton:0x1020d1510.left - 15>",
"<NSLayoutConstraint:0x174482260 AVAlphaUpdatingView:0x101fb2450.width == 0>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x174482a80 AVLoadingIndicatorView:0x101fc8c80.left >= AVButton:0x101fb2e50.right + 15>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Set the flag translatesAutoresizingMaskIntoConstraints = falseon the viewof your AVPlayerViewController. For example:
let playerViewController = AVPlayerViewController()
playerViewController.view.translatesAutoresizingMaskIntoConstraints = false
Then set your constraints on that view.
If you want the AVPlayerViewController to occupy a sub-view of your own UIViewController, then make the AVPlayerViewController a child of your view controller:
self.addChildViewController(playerViewController)
self.view.addSubview(playerViewController.view)
playerViewController.didMove(toParentViewController:self)

Resources