• 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
Core Data relationship binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data relationship binding


  • Subject: Core Data relationship binding
  • From: Niels Meersschaert <email@hidden>
  • Date: Thu, 2 Jun 2005 09:25:10 -0400

I'm exploring Core Data & I'm running into some difficulty with relationships binding.  I have a simple model of an address book created with the design tool & using the default classes.  There are two entities:

Person
name - attribute
addresses - relationship to-Many Address (inverse of Person)

Address
street - attribute
city - attribute
state - attribute
person - relationship to-One Person (inverse of addresses)

In IB, I dragged the entities to create a basic interface & chose many objects for each entity.  I left the default names of all controllers & then I created a text field that I want to display the number of addresses for a given Person.  I bound it to the Person Array Controller, using a Controller Key of selection, and a model key of addresses.@count.  I was thinking that this should take the currently selected Person, get their addresses & display a count of how many there were.  When I start adding addresses, I get an exception:

[<NSManagedObject 0x3a5380> addObserver:<NSArrayController 0x570d500> forKeyPath:@"addresses.@count" options:0x0 context:0x0] was sent to an object that is not KVC-compliant for the "addresses" property.]

In looking thru the docs, it appears that relationship properties would naturally return an NSSet.  I tried varying the binding to use addresses.count (count being a valid method name in NSSet), but still no joy.  Is it possible to do what I want with the basic NSManagedObject?

Thanks for your help, 

Niels
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: packagemaker -- filed Apple bug
  • Next by Date: XCode overzealous external editor support...
  • Previous by thread: Re: Java Remote Debugging?
  • Next by thread: XCode overzealous external editor support...
  • Index(es):
    • Date
    • Thread