0
votes

I've an NSManagedObjectContext with two entities, A and B. I've an NSArrayController bound to the NSManagedObjectContext and an NSTableView. The NSArrayController is set to list entities of type B. The array controller then feeds the table view.

The NIB where the array controller sits is called by a an NSWindowController. On init I add one instance of each object but when I get to windowDidLoad the managed object context has been populated but the array controller is empty.

Using gdb I can print the MOC visible in the window controller and the one bound to the array controller and they both have the same address.

Any clues on how to debug this?

1
Did you check the "Prepares Content" checkbox in the Attributes Inspector for your NSArrayController? Easy to forget, impossible to debug... - Roger
If you save your context, does the data appear in your store? - Roger
Yes it does. I can get data out of my MOC without any problems. If I add the data to the array controller manually it will also appear on the table. What I can't do is make the array controller see the data in the MOC, even though it's bound to the same MOC. - ruipacheco
This should just work. Double check all your bindings especially the ones for your table view. This stuff is near impossible to debug if there are no exceptions generated. As you did not post any details on this, I presumed no exceptions appear... - Roger
Nothing whatsoever. No feedback at all. I know stuff is in the MOC, I can add it to the array controller manually. What I can't do is have the array controller see the stuff in the MOC. - ruipacheco

1 Answers

0
votes

Deleted the NIB and controller and created the code from scratch. Things seem to work perfectly. I suspect this was a bug in Xcode.