Re: window controllers and managed object contexts
Re: window controllers and managed object contexts
- Subject: Re: window controllers and managed object contexts
- From: Daniel Child <email@hidden>
- Date: Sat, 27 Sep 2008 13:01:47 -0400
Hmm, well that seems to be the catch. I can't get the bindings to work
for the MOC.
First off, to set up the table displayed in the window loaded with a
separate nib file, I simply dragged in an "entity" object from the
Librarian. That doesn't set up an MOC binding, but, following an on-
line tutorial, I told it to bind the MOC parameter to File'sOwner, and
immediately the setting is managedObjectContext. (Looked promising.)
Now, when I init the window, I do pass in a copy of the App's own MOC
(I don't have multiple MOCs). But now I get the message:
not key-value coding-compliant for the value: managedObjectContext.
Which makes me wonder, just how much code needs to go into setting up
a separate window controller, and is it worth it (speed-wise) if your
app only has four or five windows. From a tidiness standpoint, it's
nice of course to separate the control portion of MVC for each window,
but is all that copying and key-value coding going to be faster than
simply loading one big nib?
And, given that Xcode is supposed to automatically set up bindings
correctly for things like Entity, why does it not work in this case?
The error message seems to suggest I need to be doing something like:
[myWindow setObject: theMOC forKey: @"managedObjectContext"
but the tutorial online uses plain accessors (with the local copy of
MOC as an ivar, not a property) ... and works. One difference is that
their's is a doc-based CoreData app, and mine is not. But I don't see
why that should matter....
So I'm forced to use a property to express MOC in the window
controller???
On Sep 26, 2008, at 3:29 PM, Kyle Sluder wrote:
Erm, NSWindowController shouldn't be asking for a MOC. Perhaps
whatever NSControllers you have in your nibs haven't had their
managedObjectContext bindings fixed?
_______________________________________________
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