Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LayoutConstraints warning since iOS 13 #21

Open
Idomo opened this issue Sep 16, 2019 · 2 comments
Open

LayoutConstraints warning since iOS 13 #21

Idomo opened this issue Sep 16, 2019 · 2 comments

Comments

@Idomo
Copy link

Idomo commented Sep 16, 2019

Hi,
Since I've upgraded to xCode 11 (GM) with the iOS 13 SDK, I got a warning about constraints each time the UIToolBar of the library was displayed.
I didn't change anything on the constraints side so I'm guessing this is an issue with the library itself.
I'd appreciate if you'll take a look on this and may find a fix.

Thanks,
Ido.

 [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:0x600000dc66c0 h=--& v=--& _UIToolbarContentView:0x7fb42fef2770.height == 0   (active)>",
    "<NSLayoutConstraint:0x600000df75c0 V:|-(0)-[_UIButtonBarStackView:0x7fb42fef3240]   (active, names: '|':_UIToolbarContentView:0x7fb42fef2770 )>",
    "<NSLayoutConstraint:0x600000df7610 _UIButtonBarStackView:0x7fb42fef3240.bottom == _UIToolbarContentView:0x7fb42fef2770.bottom   (active)>",
    "<NSLayoutConstraint:0x600000dd1fe0 UIButtonLabel:0x7fb42ffbbc90'\U05e1\U05d9\U05d5\U05dd'.centerY == _UIModernBarButton:0x7fb42fddc4a0'\U05e1\U05d9\U05d5\U05dd'.centerY + 0.5   (active)>",
    "<NSLayoutConstraint:0x600000dc5270 'TB_Baseline_Baseline' _UIModernBarButton:0x7fb42fddc4a0'\U05e1\U05d9\U05d5\U05dd'.lastBaseline == UILayoutGuide:0x600001786680'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x600000dc52c0 'TB_Top_Top' V:|-(>=0)-[_UIModernBarButton:0x7fb42fddc4a0'\U05e1\U05d9\U05d5\U05dd']   (active, names: '|':_UIButtonBarButton:0x7fb42fddc2d0 )>",
    "<NSLayoutConstraint:0x600000dc54a0 'UIButtonBar.maximumAlignmentSize' _UIButtonBarButton:0x7fb42fddc2d0.height == UILayoutGuide:0x600001782300'UIViewLayoutMarginsGuide'.height   (active)>",
    "<NSLayoutConstraint:0x600000df73e0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600001782300'UIViewLayoutMarginsGuide']-(0)-|   (active, names: '|':_UIButtonBarStackView:0x7fb42fef3240 )>",
    "<NSLayoutConstraint:0x600000dc51d0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600001786680'UIViewLayoutMarginsGuide']-(16)-|   (active, names: '|':_UIButtonBarButton:0x7fb42fddc2d0 )>",
    "<NSLayoutConstraint:0x600000df7340 'UIView-topMargin-guide-constraint' V:|-(0)-[UILayoutGuide:0x600001782300'UIViewLayoutMarginsGuide']   (active, names: '|':_UIButtonBarStackView:0x7fb42fef3240 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000dd1fe0 UIButtonLabel:0x7fb42ffbbc90'Done.centerY == _UIModernBarButton:0x7fb42fddc4a0'Done.centerY + 0.5   (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.
@tosbaha
Copy link

tosbaha commented Sep 17, 2019

I don't use this library but I came across this when I was searching the same issue. Current workaround for this problem is setting a frame for a UIToolbar So change below line

to

super.init(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 35))

Apparently, iOS 13 doesn't like toolbars with zero frames.

@Idomo
Copy link
Author

Idomo commented Jan 8, 2020

@tosbaha How did you find this "magic number" 35?
It's not a good idea to use hardcoded values on this kind of things, it may change depending the OS version and device screen size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants