View Full Version : Core Data data in a popup button cell, and the case of the missing selector

Jul 6, 2009, 04:33 PM
The Interface: (the non-thumbnail image)
The data:

@interface Job : NSObject {
NSMutableArray * drainboards; //Yes, I'm allocating memory for it in -init
@property (retain) NSMutableArray *drainboards;
@implementation Job
@synthesize drainboards;

The bindings: (images 2-4)
The explanation: In the left table column in the first image, I mean to have all of the drainboard names in a popup menu in each row. In the right column, a quantity. The drainboard objects are Core Data managed objects, but each row should represent a dictionary(keys: drainboard, quantity), which are contained by the NSMutableArray above. The array controller for the table columns is set to generate NSMutableDictionarys (in the attributes inspector pane), and its Content Array binding is set to Job.self.drainboards.

The problem: I can add and remove blank rows, but clicking the popup button cell does nothing - no menu with the drainboard names appears. If I try to set a quantity, I get this in stderr
** -[NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x16563eb0.

Thoughts? Some Core Data or bindings caveat I'm missing? Help!

Jul 6, 2009, 10:55 PM
Found part of it; Prepares Content was not checked. The problem now is, instead of drainboard.name(s) in the popup menu, I get:

<NSManagedObject: 0x1b0cf0> (entity: CCCEDrainboard; id = 0x171290 <x...CEDrainboard/p104; data: { name = "Double Slope"; price = 300 }

If I bind the column to arrangedObjects.price rather than arrangedObjects.name, I get just the price. Is "name" a reserved word?

Jul 7, 2009, 10:40 PM
If anyone cares, the solution is to bind Selected Object to the Job's NSMutableArray array controller.