我的NSTreeController設置核心數據的父級屬性而不是子級屬性。NSTreeController沒有設置核心數據的子屬性
我有這樣
Item
title (string)
isLeaf (boolean,readonly)
parent -> Group (inverse children)
Group (parent entity Item)
children -> Item (inverse parent)
Leaf (parent entity Item)
核心數據模型,我再與NSOutlineView顯示它並使用NSTreeController。我使用方法 - [NSTreeController insertObject:atArrangedObjectIndexPath:]嘗試插入Leaf's,葉子父級屬性設置正確,但父級Group.children屬性仍然設置爲零。
當我運行該項目,我得到的控制檯
Warning: <NSTreeController: 0x7fcd93c19d20>[object class: NSMutableDictionary] childrenKeyPath cannot be nil. To eliminate this log message, set the childrenKeyPath attribute in Interface Builder
即使childrenKeyPath在界面生成器設置以下警告,爲什麼它使用的NSMutableDictionary時,我有一個NSManagedObject子類SavedItem,SavedGroup和SavedLeaf。我已經下載了幾個例子,但我不明白他們在做什麼,我不是。