Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

Crash on macOS Catalyst while collapsing any InlineRow

Open jurex opened this issue 4 years ago • 7 comments

Eureka v5.2.1 Xcode 11.4.1 macOS Catalina 10.15.4 MacBook Pro 13-inch, 2018

It's working fine on iOS, but it's crashing on macOS using Catalyst.

Out of bounds exceptions when trying to collapse any inline row (i.e. DateInlineRow, ...) Thread 1: Fatal error: Section: Index out of bounds

/Pods/Eureka/Source/Core/Section.swift, line 247 Screenshot 2020-04-22 at 10 13 48

Screenshot 2020-04-22 at 10 09 49

jurex avatar Apr 22 '20 08:04 jurex

+1

phr85 avatar Apr 30 '20 16:04 phr85

@jurex Could you solve this issue or at least some kind of workaround?

phr85 avatar Apr 30 '20 16:04 phr85

nope, the only workaround I found for now is to not use any inline rows in catalyst.

jurex avatar Apr 30 '20 16:04 jurex

Same problem on macOS Catalina 10.15.3

Schlaubischlump avatar May 01 '20 00:05 Schlaubischlump

I found this works around it for now. This doesn't seem like the right solution but it works around this problem in a brute force type of way. Edit Core.swift:

   open func rowsHaveBeenAdded(_ rows: [BaseRow], at indexes: [IndexPath]) {
        guard animateTableView else { return }
        
        // Picker InlineRow rows will crash on close with Eureka when running on the mac.
#if targetEnvironment(macCatalyst)
        for row in rows {
           if row is BaseInlineRowType || row is _DatePickerRow || row.baseCell is UIPickerViewDataSource {
                tableView?.reloadData()
                return
            }
        }
#endif

        tableView?.beginUpdates()
        tableView?.insertRows(at: indexes, with: insertAnimation(forRows: rows))
        tableView?.endUpdates()
    }

    open func rowsHaveBeenRemoved(_ rows: [BaseRow], at indexes: [IndexPath]) {
        guard animateTableView else { return }
        
        // Picker InlineRow rows will crash on close with Eureka when running on the mac.
#if targetEnvironment(macCatalyst)
        for row in rows {
           if row is BaseInlineRowType || row is _DatePickerRow || row.baseCell is UIPickerViewDataSource {
                tableView?.reloadData()
                return
            }
        }
#endif
        
        tableView?.beginUpdates()
        tableView?.deleteRows(at: indexes, with: deleteAnimation(forRows: rows))
        tableView?.endUpdates()
    }

gossmer avatar May 29 '20 04:05 gossmer

+1

+1

miajed avatar Jul 05 '20 04:07 miajed

Does the workaround in #2103 work for you?

mats-claassen avatar Oct 19 '20 12:10 mats-claassen