Core Data Reflexive Relationship and Cocoa Bindings
Michael Moore
dev at terbium.org
Mon Jul 21 18:30:38 PDT 2008
Hi all, hoping someone can help me with this problem.
I'm building an app that is basically a contact list. This is a Core
Data Document-Based app.
There is a single entity in my data model, "Person." There are various
attributes, "First", "Last", "Phone," etc. I set all of these using
Cocoa Bindings in IB via a NSArrayController.
There is one relationship: "reportsTo". I want this to reference
another "Person" entity. This relationship is set up in my xcdatamodel
as "Optional", with the Destination set as "Person". No Inverse
Relationship is set, and the "To-Many Relationship" checkbox is not
checked, as it's a one-to-one relationship.
I have a NSPopUpButton bound to my NSArrayController, with the following
settings:
"Content" is bound to my controller, with the Controller Key
"arrangedObjects". Nothing is listed for the Model Key Path.
"Content Values" is bound to my controller, with the Controller Key
"arrangedObjects" and the Model Key Path "employeeID" (an attribute).
"Inserts Null Placeholder" is set as well here.
"Selected Value" is bound to my controller, with the Controller Key
"selection" and the Model Key Path "reportsTo" (a relationship).
When I run the app and add a few employees to the list, the
NSPopUpButton for "reportsTo" populates, but when I try to select one of
the items, it does not work and the following two lines appear in the
console:
2008-07-21 20:28:19.660 MR2[21415:10b] *** -[NSCFString
_isValidRelationshipDestination]: unrecognized selector sent to instance
0xa03e99f0
2008-07-21 20:28:19.678 MR2[21415:10b] *** -[NSCFString
_isValidRelationshipDestination]: unrecognized selector sent to instance
0xa03e99f0
I can't figure out what I'm doing wrong. Any thoughts?
More information about the MacOSX-dev
mailing list