xmartlabs / Eureka

Elegant iOS form builder in Swift
https://eurekacommunity.github.io
MIT License
11.77k stars 1.33k forks source link

MultivaluedSection constraint issue #1770

Open Claeysson opened 5 years ago

Claeysson commented 5 years ago

I have a Eureka form that contains a MultivaluedSection. At first no add or delete buttons are shown. But if I add a row, and then delete it by swiping left the buttons suddenly appears. I also get an autoconstraint warning right before the buttons appears.

+++
            MultivaluedSection(multivaluedOptions: [.Reorder, .Insert, .Delete],
                               header: "Allowed URLs",
                               footer: "Insert allowed URLs, all other URLs will be disallowed!") {
                                $0.tag = "allowedURLs"
                                $0.addButtonProvider = { section in
                                    return ButtonRow(){
                                        $0.title = "Add URL"
                                        }.cellUpdate { cell, row in
                                            cell.textLabel?.textAlignment = .left
                                    }
                                }
                                $0.multivaluedRowToInsertAt = { index in
                                    return NameRow() {
                                        $0.placeholder = "URL"
                                    }
                                }
                                $0 <<< NameRow() {
                                    $0.placeholder = "URL"
                                }
            }

This is what it looks like before: before

And this is how it looks after: after

This is the error I get right before the buttons appear:

2019-01-30 16:42:58.270283+0100 Kiosker[73898:4029148] [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:0x6000025b9d10 V:|-(11)-[UITextField:0x7faa75030800]   (active, names: '|':UITableViewCellContentView:0x7faa74643f20 )>",
    "<NSLayoutConstraint:0x6000025b9770 V:[UITextField:0x7faa75030800]-(11)-|   (active, names: '|':UITableViewCellContentView:0x7faa74643f20 )>",
    "<NSLayoutConstraint:0x6000025ab0c0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7faa74643f20.height == 0.5   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000025b9770 V:[UITextField:0x7faa75030800]-(11)-|   (active, names: '|':UITableViewCellContentView:0x7faa74643f20 )>

I'm using Xcode 10.1 and IOS 12.1

mats-claassen commented 5 years ago

Hi @Claeysson did you check that tableView.isEditing is true?

Claeysson commented 5 years ago

tableView.isEditing = true did the trick!

Thanks!

Claeysson commented 5 years ago

Too fast... The editing buttons are now shown, but the constraint error when a row is deleted are still there.

I've also tried the Eureka example project and it gives me the same error when an multivalued textfield is deleted. Bug?

[2019-02-03 19:01:40.582675+0100 Kiosker[16878:1095571] [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:0x600002e4b2f0 V:|-(11)-[UITextField:0x7f91f2014400]   (active, names: '|':UITableViewCellContentView:0x7f91f1425250 )>",
    "<NSLayoutConstraint:0x600002e4b340 V:[UITextField:0x7f91f2014400]-(11)-|   (active, names: '|':UITableViewCellContentView:0x7f91f1425250 )>",
    "<NSLayoutConstraint:0x600002e65fe0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7f91f1425250.height == 0.5   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600002e4b340 V:[UITextField:0x7f91f2014400]-(11)-|   (active, names: '|':UITableViewCellContentView:0x7f91f1425250 )>

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.
]
PierreBrisorgueil commented 5 years ago

Hello, @mats-claassen similar error on my side,

2019-10-31 20:38:48.962664+0100 waosSwift[2724:558886] [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:0x28346ad00 'accessoryView.bottom' _UIRemoteKeyboardPlaceholderView:0x10fa37c00.bottom == _UIKBCompatInputView:0x1043bd010.top   (active)>",
    "<NSLayoutConstraint:0x283426580 'assistantHeight' TUISystemInputAssistantView:0x1043a15e0.height == 45   (active)>",
    "<NSLayoutConstraint:0x283422850 'assistantView.bottom' TUISystemInputAssistantView:0x1043a15e0.bottom == _UIKBCompatInputView:0x1043bd010.top   (active)>",
    "<NSLayoutConstraint:0x28346aa80 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x10fa37c00]-(0)-[TUISystemInputAssistantView:0x1043a15e0]   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x28346aa80 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x10fa37c00]-(0)-[TUISystemInputAssistantView:0x1043a15e0]   (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's arrived when I switch from EmailRow to previous TextRow, only in this case, no problem with TextRow -> TextRow, or TextRow -> EmailRow

the only thing I see is the appearance of the suggestion part of the keyboard which could enlarge the keyboard area and create the problem of constraints. This arrived only when you switch from EmailRow to TextRow