• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTreeController & NSOutlineView bindings w/ Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTreeController & NSOutlineView bindings w/ Core Data


  • Subject: Re: NSTreeController & NSOutlineView bindings w/ Core Data
  • From: Steven Huey <email@hidden>
  • Date: Tue, 18 Mar 2008 09:15:04 -0400

Ian,

Check out http://tinyurl.com/2txz6o , it's the section of the "Core Data Programming Guide" titled "Managed Object Accessor Methods", it shows what methods you need to implement for working with multi-value relationships.

Also take a look at the methods generated by selecting your "sections" relationship in the data modeler, and then choose one of the following pairs of items from the Design > Data Model menu:

= For Obj-C 1.0 =
Copy Method Declarations to Clipboard
Copy Method Implementations to Clipboard

= For Obj-C 2.0 =
Copy Obj-C 2.0 Method Declarations to Clipboard
Copy Obj-C 2.0 Method Implementations to Clipboard

Hope this helps.

Best regards,
Steven Huey

On Mar 17, 2008, at 1:48 PM, Ian Kennedy wrote:

I'm hoping this is simple, but everything I read makes it seem much more complicated than I think it should be.

I have this simple model: http://img.skitch.com/20080317-8wxj68njnsek652bnwaahm3t5b.png

In IB I instantiated an NSTreeController bound to the application delegate with a path of managedObjectContext. I set the entity to Course, checked 'Prepares Content' and added a key path for Children to 'sections'.

I can add courses, sections, and coursefiles, and the outlineview seems to recognize that the Course contains a Section, but it tells me that the entity Section is not kvc compliant for the key sections: http://img.skitch.com/20080317-qkmratwtpkfqx47rhqrtey4nqy.png

I've noted in the docs that:
"All child objects for the tree must be key-value-coding compliant for the same child key path. If necessary you should implement accessor methods in your model classes, or categories on those classes, that map the child key to the appropriate class-specific method name."


I have set up NSManagedObject subclasses for each of my model objects. However, I am not able to find an example of which accessor methods I should add to map the children....

Any help would be much appreciated, I've been struggling with this for days.

Thanks in advance,
Ian Kennedy

-- Steven Huey email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSTreeController & NSOutlineView bindings w/ Core Data (From: Ian Kennedy <email@hidden>)

  • Prev by Date: Re: Setting Web Proxy programmatically
  • Next by Date: Re: Prevent application activation after dragging items to the Dock icon?
  • Previous by thread: NSTreeController & NSOutlineView bindings w/ Core Data
  • Next by thread: Apple Events and automatic AutoReleasePool managment
  • Index(es):
    • Date
    • Thread