Core Data Issue with Binding
Core Data Issue with Binding
- Subject: Core Data Issue with Binding
- From: Matthew Miller <email@hidden>
- Date: Wed, 10 Feb 2010 12:26:53 -0500
I'm having trouble with a Cocoa app built around an NSManagedObject model. Without getting too far into the weeds, there is a Player object:
@class Program;
@interface Player : NSManagedObject {
}
@property (nonatomic, retain) NSDate *DateOfBirth;
@property (nonatomic, retain) NSString *FirstName;
@property (nonatomic, retain) NSString *LastName;
@property (nonatomic, retain) NSNumber *DraftClass;
@property (nonatomic, retain) NSNumber *DraftPick;
@property (nonatomic, assign) BOOL Retired;
@property (nonatomic, retain) NSSet *PlaysFor;
@property (nonatomic, retain) Program *School;
@property (readonly) NSString *DisplayName;
@end
The NSSet * points to a second NSManagedObject model entity, RosterSpot. That PlaysFor relationship is a to-many (a Player can have played on several rosters). The app presents a list of Players in an NSTableView by leveraging an NSArrayController (Players). I have the details of each player presented in a set of fields next to that table based on the selection in Players. I also have a second, smaller NSTableView in which I'd like to present the RosterSpot data for that same selected Player.
I've created a second NSArrayController and I've tried everything to get it to allow me to add RosterSpot data to the selected Player. I've tried to bind the "Managed Object Context" to the Players NSArrayController with Controller Key "selection" and the Model Key "Plays For". I've tried setting the Content Set (under Content Controller) to Players.selection.PlaysFor. No luck. I can't seem to bind that RosterSpot information.
The app compiles without complaint and I can add Players at will with their information displayed but when I try to add RosterSpot information, I get nothing. The addition is a simple NSButton that has its action set to the add: method of the second NSArrayController.
I'm certain someone has done this and I'm just missing something. Appreciate any help.
Regards,
Matt
_______________________________________________
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