EurekaCommunity/SplitRow

Layout constraints break on iOS 9 when used as row provider for MultivaluedSection

enquora opened this issue · 10 comments

Autolayout fails when using SplitRow as a row provider for a MultiValuedSection.
In this case, left row is a PushRow, right row is a TextRow.

With a single row in section:
single row in multivalued section

With two rows in section
multiple rows in multivalued section

This occurs under iOS 9 only.

@enquora thanks for the investigation. How important is iOS 9 support for you?

It seems a very small subset of devices still runs on iOS 9 - so I'm wondering if its enough to just modify this projects requirements and set it to iOS >= 10?

We support 9.3.5 or later and have users that require it.

wrt what should be supported (in general) - publishing a plugin for a project and restricting support to a subset of that provided by the host project because it might be inconvenient to match support doesn't seem congruent with the spirit of a community.

Your right with the point of congruence. We should support iOS 9 because Eurekadoes.

That said, I can't promise to deliver a bugfix within this year. If you have some time digging into it and submit a pull request I'll happily apply it.

I will be working on it.

Is it because SplitRow is not considering the possibility of other leading and trailing views existing? MultivaluedSection provides the option of displaying UITableViewCell's standard accessory and editing controls. In my single row screenshot example, Delete is not enabled so the editing control is not displayed, and by definition a single row cannot be re-ordered, so no drag handle is displayed.

If Delete is enabled for the example, even the single row example breaks.

I see no constraints in the SplitRow source code which account explicitly for these other controls. I haven't tested this case on iOS 10, but iOS 11, at least, seems to introduce changes which handle this case for use without being explicit.

[Update]: Disabling Reorder and Delete in the parent MultivaluedSection does result in correct and expected layout. The problem is the lack of explicit constraints from leftRow to any potentially leading view, and from rightRow to any potentially trailing views which the parent row might have.

@enquora I was able to reproduce an created an example target to debug this:
https://github.com/EurekaCommunity/SplitRow/tree/ios9

Unfortunately I was not able to figure out how to solve. Any ideas?

Running in the simulator under iOS 9 produces these warnings:

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:0x7fdbabe573b0 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe58b90 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbabe58b90 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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-12-06 10:12:34.883 Fieldwork-NG[17966:14902587] 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:0x7fdbad409150 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbad4094d0 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad4094d0 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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-12-06 10:12:34.885 Fieldwork-NG[17966:14902587] 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:0x7fdbad410d10 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbad4f3140 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad4f3140 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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-12-06 10:12:34.910 Fieldwork-NG[17966:14902587] 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:0x7fdbabe598d0 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe5f320 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbabe5f320 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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-12-06 10:12:35.118 Fieldwork-NG[17966:14902587] 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:0x7fdbad317960 V:|-(11)-[UITextField:0x7fdbad4084b0]   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad318dc0 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad40e650 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad40aa20(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad318dc0 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>

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-12-06 10:12:35.140 Fieldwork-NG[17966:14902587] 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:0x7fdbad5d4180 V:|-(11)-[UITextField:0x7fdbad4084b0]   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad4f3140 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad40e650 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad40aa20(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad4f3140 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>

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-12-06 10:12:35.193 Fieldwork-NG[17966:14902587] 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:0x7fdbabe60360 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe60030 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbabe60030 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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-12-06 10:12:35.197 Fieldwork-NG[17966:14902587] 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:0x7fdbad419ba0 V:|-(11)-[UITextField:0x7fdbad4084b0]   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad5eeae0 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>",
    "<NSLayoutConstraint:0x7fdbad40e650 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad40aa20(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad5eeae0 V:[UITextField:0x7fdbad4084b0]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad40aa20 )>

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-12-06 10:12:35.218 Fieldwork-NG[17966:14902587] 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:0x7fdbad4f3200 V:|-(11)-[UITextField:0x7fdbabe3f740]   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbad5d4bf0 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>",
    "<NSLayoutConstraint:0x7fdbabe57580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fdbad528900(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdbad5d4bf0 V:[UITextField:0x7fdbabe3f740]-(11)-|   (Names: '|':UITableViewCellContentView:0x7fdbad528900 )>

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.

Under iOS 11, a warning:

[Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.

One or more of SplitRow's content views seem to be either under, over or incorrectly constrained. Removing the constraints one at a time and observing the results would be a classic debugging technique.

@enquora right. been there, done that. Don't know why these errors and/or warnings are generated.

Fixed with the latest commits to the master branch. Feel free to reopen if you still encounter any errors.