I am trying to write a very simple Core Data OS X application.
Here's what I've done so far:
- Create a new Core Data application called
PortalMan
. This also created anNSAppDelegate
calledPortalManAppDelegate
. - Go to the
PortalMan.xcdatamodeld
data model and create a new entity calledRepo
with three attributes:active
,branch
,path
.active
is a Boolean, the other two are Strings. - Open the interface editor for
MainMenu.xib
- Drag a new
NSArrayController
to the document space - On the Attributes tab of the
NSArrayController
, set the "Mode" to "Entity Name" and set the "Entity Name" attribute as "Repo" - Check the "Prepares Content" box
- On the Bindings tab for the
NSArrayController
, select the Managed Object Context binding. Enable it, and bind it to the "Portal Man App Delegate". - Set "Model Key Path" to "managedObjectContext".
- Drag a table view to the window
- Add a column, and in its "Value" Binding, set "Bind To: Array Controller", set the "Controller Key" to "arrangedObjects" and the "Model Key Path" to "branch"
I also added a button and bound it to the Array Controller's add
method.
When I try and run my application, I get this error:
2012-01-06 16:01:43.650 PortalMan[656:707] An uncaught exception was raised
2012-01-06 16:01:43.651 PortalMan[656:707] [<NSApplication 0x100401750> valueForUndefinedKey:]: this class is not key value coding-compliant for the key branch.
This makes me think it's not grabbing my Core Data "Repo" model appropriately, because "Repo" does have a "branch" attribute.
Any thoughts on this or how I can debug it?
Thanks!