“[something copyWithZone:]: unrecognized selector sent to instance” when using Bindings / Core Data

前端 未结 8 1626
情深已故
情深已故 2020-12-28 13:49

(self asking and self-answering because I spent hours on the web looking for this, and most of the resources all say \"I solved it in the end\" without giving an explanation

相关标签:
8条回答
  • 2020-12-28 14:29

    Thank you for this solution, it pointed me in the right direction. For those of you learning InterfaceBuilder I hope this additional information helps.

    It turns out while building a tutorial I had inadvertently Bound a Text field Cell - Text Cell to my ArrayController.ObjectValue.
    The real binding was supposed to happen at

    Table Column > Table Cell View > Static Text - Table View Cell

    That one was correct, but visually in the tree below it (for reasons I don't understand yet IB needs a Text Field Cell.) I had also bound:

    Table Column > Text Field Cell - Text Cell

    It was that second binding which trying to copy the whole object because the path was objectValue with no key, it was triggering this error.

    Probably a newbie mistake, but it meant walking through EVERY object and checking for bindings and I came across this one.

    0 讨论(0)
  • 2020-12-28 14:29

    I got this when I returned a view from the NSTableViewDataSource function -tableView:objectValueForTableColumn:row:. Instead, it is supposed to return a value (e.g. NSString*). (Not surprising given its name, but the error is not helpful in discovering this. The function I was thinking of is -tableView:viewForTableColumn:row: in NSTableViewDelegate.)

    0 讨论(0)
提交回复
热议问题