Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7633453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:53:18+00:00 2026-05-31T06:53:18+00:00

My NSTreeController is setting Core Data parent attributes but not children attributes. I have

  • 0

My NSTreeController is setting Core Data parent attributes but not children attributes.

I have a Core Data model like this

Item
    title (string)
    isLeaf (boolean,readonly)
    parent -> Group (inverse children)

Group (parent entity Item)
    children -> Item (inverse parent)

Leaf (parent entity Item)

I am then displaying it with NSOutlineView and using an NSTreeController. I use the method -[NSTreeController insertObject:atArrangedObjectIndexPath:] to try to insert Leaf’s, the leafs parent property is set correctly but the parent Group.children property remains set to nil.

When I run the project I get the following warning on the console

Warning: <NSTreeController: 0x7fcd93c19d20>[object class: NSMutableDictionary] childrenKeyPath cannot be nil. To eliminate this log message, set the childrenKeyPath attribute in Interface Builder

even though childrenKeyPath is set in interface builder and why is it using NSMutableDictionary when I have a NSManagedObject subclasses SavedItem, SavedGroup and SavedLeaf. I have downloaded a couple of examples but I can not see what they are doing that I am not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:53:19+00:00Added an answer on May 31, 2026 at 6:53 am

    The solution for others, is I was trying to be clever and instead of defining the isLeaf property in the actual core data definition. I was try to hard code it in the implementation as returning true or false depending on whether it was Group or Leaf, for some reason NSTreeController does not like this, even if you also define it in the base class. I have overridden the awakeFromInsert method and set it there.

    Also of interest is that NSTreeController also does not like it if you define the children property in the base class to do nothing/return nil (ie so the the Group subclass can override it), children entities will be saved but they will no be displayed. This is something I did in trying to solve my initial problem, I thought it was something people might like to know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSTreeController that manages an entity is a core data model and
I have a non document-based Core Data application. There's an NSTreeController that manages a
I have an NSTreeController bound to an NSOutlineView (no core data). From Cocoa's reference:
Background Multi threaded Core Data application NSTreeController and NSOutlineView with bindings Creates children objects
In page 40 of Marcus Zarra's Core Data book, he suggests that, since NSTreeController
i have this simplified Model: https://i.stack.imgur.com/d2WsV.png I have these Elements ordered in an NSOutlineView
I have the following setup using Core Data: Nib1: A WindowController with two custom
In my app, I have an NSOutlineView that gets its data from a NSTreeController
I have touched on this question in others before but after writing an answer
I have now nearly figured out how to Filter a NSTreeController, to do this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.