RadioGroup icon indicating copy to clipboard operation
RadioGroup copied to clipboard

RadioGroup Layout Constraint Error.

Open rlegault33 opened this issue 3 years ago • 3 comments

Description of the problem: When running, I am seeing that one of the constraints is 0 for a table size so the constraint is being ignored(dropped). v 1.4.1 Loaded with cocoaPods.

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600002030fa0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide']-(0)-| (active, names: '|':UIStackView:0x7fb001407cf0 )>

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. 2020-11-08 18:44:01.921289-0500 RadioGroupBug[90413:13898342] [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:0x60000202c640 h=--& v=--& RadioGroup.width == 0 (active, names: RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002074d70 H:|-(0)-UIStackView:0x7faff2b136b0 (active, names: RadioGroupItem:0x7faff2b11f20, '|':RadioGroupItem:0x7faff2b11f20 )>", "<NSLayoutConstraint:0x600002074dc0 UIStackView:0x7faff2b136b0.right == RadioGroupItem.right (active, names: RadioGroupItem:0x7faff2b11f20 )>", "<NSLayoutConstraint:0x6000020317c0 H:|-(0)-[UIStackView:0x7fb001407cf0] (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002030cd0 UIStackView:0x7fb001407cf0.rightMargin == RadioGroup.rightMargin (active, names: RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002011b30 'UISV-alignment' RadioGroupItem.leading == RadioGroupItem.leading (active, names: RadioGroupItem:0x7faff2b0fd00, RadioGroupItem:0x7faff2b11f20 )>", "<NSLayoutConstraint:0x600002010be0 'UISV-alignment' RadioGroupItem.trailing == RadioGroupItem.trailing (active, names: RadioGroupItem:0x7faff2b0fd00, RadioGroupItem:0x7faff2b11f20 )>", "<NSLayoutConstraint:0x600002010960 'UISV-canvas-connection' UIStackView:0x7fb001407cf0.leading == RadioGroupItem.leading (active, names: RadioGroupItem:0x7faff2b0fd00 )>", "<NSLayoutConstraint:0x600002010c80 'UISV-canvas-connection' UIStackView:0x7faff2b136b0.leading == RadioButton.leading (active, names: RadioButton:0x7faff2b12320 )>", "<NSLayoutConstraint:0x600002010b40 'UISV-canvas-connection' H:[UIView:0x7faff2b0d560]-(0)-| (active, names: '|':UIStackView:0x7faff2b136b0 )>", "<NSLayoutConstraint:0x600002012440 'UISV-canvas-connection' H:[RadioGroupItem]-(0)-| (active, names: RadioGroupItem:0x7faff2b0fd00, '|':UIStackView:0x7fb001407cf0 )>", "<NSLayoutConstraint:0x600002010e60 'UISV-spacing' H:[RadioButton]-(4)-[UIView:0x7faff2b0d560] (active, names: RadioButton:0x7faff2b12320 )>", "<NSLayoutConstraint:0x6000020316d0 'UIView-leftMargin-guide-constraint' H:|-(0)-UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide' (active, names: '|':UIStackView:0x7fb001407cf0 )>", "<NSLayoutConstraint:0x600002031810 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x600003a28380'UIViewLayoutMarginsGuide' (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002030d20 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':UIStackView:0x7fb001407cf0 )>", "<NSLayoutConstraint:0x600002030b40 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600003a28380'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600002010e60 'UISV-spacing' H:[RadioButton]-(4)-[UIView:0x7faff2b0d560] (active, names: RadioButton:0x7faff2b12320 )>

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. 2020-11-08 18:44:01.972791-0500 RadioGroupBug[90413:13898342] [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:0x60000202c640 h=--& v=--& RadioGroup.width == 0 (active, names: RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x6000020317c0 H:|-(0)-[UIStackView:0x7fb001407cf0] (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002030cd0 UIStackView:0x7fb001407cf0.rightMargin == RadioGroup.rightMargin (active, names: RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x6000020316d0 'UIView-leftMargin-guide-constraint' H:|-(0)-UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide' (active, names: '|':UIStackView:0x7fb001407cf0 )>", "<NSLayoutConstraint:0x600002031810 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x600003a28380'UIViewLayoutMarginsGuide' (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>", "<NSLayoutConstraint:0x600002030d20 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':UIStackView:0x7fb001407cf0 )>", "<NSLayoutConstraint:0x600002030b40 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600003a28380'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: RadioGroup:0x7fb001407b00, '|':RadioGroup:0x7fb001407b00 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600002030d20 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600003a281c0'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':UIStackView:0x7fb001407cf0 )>

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.

Minimal project that reproduces the problem (so I'll be able to figure out how to fix it): [link to a Minimal Reproducible Example as described at https://ootips.org/yonat/repex ] You should be able to download it from here. Xcode 12.1 https://github.com/rlegault33/RadioGroupBug

rlegault33 avatar Nov 09 '20 00:11 rlegault33

Not sure how to resolve the warning, but I recommend adding .fixedSize() when using RadioGroupPicker in SwiftUI.

yonat avatar Nov 15 '20 07:11 yonat

I tried fixedSize() but the runtime warning still occurred. I am not very familiar with the constraints to make any suggestions.

rlegault33 avatar Nov 17 '20 00:11 rlegault33

Yes, I'm not sure how to fix the warning. But fixedSize() seems to help make the layout work better.

yonat avatar Nov 17 '20 12:11 yonat