NSTreeController Core Data Duplicate Entries Problem

  • I have a simple core data application set up with 1 entity for
    tracking folders.  This entity has a circular reference to itself to
    mark the Children and Parent objects.  I then added an
    NSTreeController to a simple form and hooked it up to an
    NSOutlineView.  After hooking up the bindings and a add and delete
    button I can add records to the tree controller and the display works
    fine.

    My problem is, when I reopen the application the data was not being
    loaded into the NSTreeControl, so checked the prepares content button
    and my data showed up.  Now when I add a new child entity to one of my
    existing entities I get a duplicate parent created.

    Example:
    Folder 1
      Child 1
    Folder 2

    When I add a Child 1 to Folder 1 I get the following:

    Folder 1
      Child 1
    Folder 2
      Child 1
    Folder 3

    The child record is being created, but a new parent record (Folder 3)
    is also being created.  The add button is hooked up to the addChild:
    method on the NSTreeController.

    How do I stop this duplicate entry problem?

    Thanks in advance.
    Chris Schmitt
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today