I have a MyViewController class which inherits from a MyGeneralViewController (itself a NSViewController subclass). In MyViewController xib file, I added two NSComboBox, and selected "use datasource" in IB and connected the datasource and delegate outlets for both. (they all refer to the same object for that)
Then I implemented the numberOfItemsInComboBox:
and comboBox:objectValueForItemAtIndex:
in my class. When I run the application, I got two identical console messages (one for each combo I presume):
"Illegal NSComboBox data source (<MyViewController: 0x6300001404d0>). Must implement numberOfItemsInComboBox: and comboBox:objectValueForItemAtIndex:"
After many essays, I decided to remove these combos from IB and create/manage them programmatically (setting the useDatasource flag to TRUE, datasource etc). Still the same message in console. I noticed in this situation that although my combos are alive, after setting their datasource and delegate to self (with appropriate delegations) the combo.datasource
and combo.delegate
return nil.
Then, I created a special NS Object subclass designed only to serve at the datasource for these combos: same message.
In a desperate try, I removed this MyDataSource class and transferred the NSComboDataSource and NSComboDelegate stuff to MyViewController superclass. You know what? "Illegal NSComboBox data source (<MyGeneralViewController: 0x6200001404a2>). Must implement numberOfItemsInComboBox: and comboBox:objectValueForItemAtIndex:"
For all this tries, I tested both IB and programmatically approach. But always got the same warning (and empty NSComboBox content). I run Xcode 9.2 under Sierra, for a 10.11 target (also tried for 10.12 with no success) - Any idea?