1

I have a Core Data based Document backed application making heavy use of cocoa-bindings. I'm using an NSTreeController for populating an NSBrowser. The main entity has a set of children, accessible via a relationship called "children". I have no problem adding children and displaying them in the NSBrowser. However, after I save a document and reopen it, only the main entities show in the browser, not their children. I have verified by examining the file that the children are being saved along with a proper relationship (and inverse) to the main entities. Has anyone else ever seen this? Is there some obvious binding/setting that I'm probably missing?

davecom
  • 1,499
  • 10
  • 30
  • The leaf and count keypaths aren't misleading when you're reopening? – stevesliva Nov 23 '14 at 19:12
  • I'm not using count and leaf is just a BOOL that is NO for the parent and YES for the children. – davecom Nov 23 '14 at 19:32
  • I didn't want to overcomplicate for the question but technically it's a 3 pane NSBrowser and the children have children too which are the actual leafs. It goes Section->Question->Answer with the first two having leaf set to NO and Answer having it as Yes. questions and answers are accessible via children. – davecom Nov 23 '14 at 19:34

1 Answers1

0

I neglected to mention that I'm using ordered relationships. It seems this behavior (or lack of behavior) is related to bugs in Core Data's use of ordered sets in relationships. I changed the relationships to not being ordered and they started loading correctly after being saved. For more information see this question: How to bind NSTreeController's Children to Core Data ordered to-many-relationship?

Community
  • 1
  • 1
davecom
  • 1,499
  • 10
  • 30