Why is my NSOutlineView datasource nil?

后端 未结 2 1716
孤城傲影
孤城傲影 2021-01-28 08:12

This is a follow-on question from my previous one relating to why my managedObjectContext was returning to nil. I thought the direction of the question would get buried

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-28 09:01

    Most of the time, this means that you have inadvertently created two instances of your class. One is in your nib and hooked up to everything, while the other is either created in code or created elsewhere in a nib without any connections. An easy way to prove that this is happening is to log self both in awakeFromNib and some method that's seeing nil — you'll see different addresses for the two objects. You'll also find that outlineView itself is nil, since the outlet isn't hooked up to anything.

提交回复
热议问题