1

The context

I have an error with the datasource of my NSTableView.

The error is

* Assertion failure in -[NSTableView _uncachedRectHeightOfRow:], /SourceCache/AppKit/AppKit-1265.19/TableView.subproj/NSTableView.m:1784

at the line self.tableView scrollRowToVisible:0] ;.

The strange description

When I try to debug this error and type in the debugger

po [self tableView:self.tableView viewForTableColumn:[self.tableView tableColumns][0] row:0]

I get

<NSTableRowView: 0x6000001b7300> - row: -1.

My question is:

  • What is this row: -1? (I don't see any row property in NSTableRowView)

  • What kind of hints can this information gives me on the first error?

Colas
  • 3,473
  • 4
  • 29
  • 68
  • 1
    Are you using a delegate as well? `tableView:heightOfRow` cannot return zero. It would be a neat way to make rows disappear, but alas. I mention it because the assertion failure is in `uncachedRectHeightOfRow`. I guess you could have issues with the row height being zero in recycled cells, too. – stevesliva Apr 15 '14 at 16:14
  • The problem was indeed caused by a 0 height. I am also using a delegate. – Colas Apr 15 '14 at 16:17
  • @stevesliva Do you want to make your comment an answer? – Colas May 02 '15 at 16:18

1 Answers1

2

If you are using a NSTableViewDelegate , then tableView:heightOfRow can not return zero.

It would be a neat way to make rows disappear, but alas. I mention it because the assertion failure is in -[NSTableView _uncachedRectHeightOfRow:].

You might also have issues with the row height being zero in recycled cells.

Will
  • 1,697
  • 17
  • 34
stevesliva
  • 5,351
  • 1
  • 16
  • 39