What is causing the compile error: Illegal NSTableView data source?

355 Views Asked by At

After some 'cleaning' of a working app, the main window appears as designed in the MainWindow.xib.

  • I deleted a MainWindowViewController object in IB. (was beneath Font Manager)
  • MainWindow.xib has it's Custom class set to MainWindowViewController
  • The table uses Content Mode - View Based
  • The two required methods ARE included in that implementation file
  • included in header file
  • Table view connection has been made to File's Owner

EDIT: Does the full error message give a clue? Why the NSApplication?

*** Illegal NSTableView data source (<NSApplication: 0x100607ad0>).

What am I missing? What should I check to resolve?

Image included to help visualize.

Screenshot of MainWindow.xib

EDIT 2: (New info)

I deleted the data source & delegate connection from the table view and the error disappeared. The same IB designed window opens with an empty table view.

1

There are 1 best solutions below

0
On BEST ANSWER

My 'project' is more complicated than the documentation covers. How to add a Window Controller to the Cocoa/Core Data template and utilize this controller is not easily found.

The most pronounced symptom was that the code in the intended controller was not being executed. The 2 required delegate methods were present. awakeFromNib wasn't being called either.

After more research, it appears the 'missing link' is the (previously deleted) NSObject set to the custom class of MainWindowViewController or MainWindowController in the nib file. I'm still looking for why this needs to be or why connecting to the File's Owner doesn't make the connection.

On the one hand, we can set the File's Owner to the custom class (MainWindow)ViewController or (Main)WindowController and connect the contained views to File's Owner. This doesn't work as I expected.

On the other hand, (apparently correct) we can add an NSObject to the MainMenu.xib file, set it's custom class to the (MainWindow)ViewController or (Main)WindowController and then connect outlets to the subviews to this object. The step of adding this object in IB is the only way I could find of connecting the window to the controller.