how to get a managedObjectContext in a nib file
how to get a managedObjectContext in a nib file
- Subject: how to get a managedObjectContext in a nib file
- From: Michael Thon <email@hidden>
- Date: Wed, 2 Sep 2009 13:53:53 +0200
I created a new nib file in my project and in that nib file I need an
array controller bound to my app's managed object context. I made an
instance of AppDelegate in the nib file and bound to that. The array
controller works except that entities added to the array are not being
permanently saved to the store. Maybe making a new instance of
AppDelegate is not the thing to do.
Next, I made File's Owner in the nib file my subclass of
NSWindowController. Then I made a managedObjectContext property and
in awakeFromNib I set that value with :
managedObjectContext = [[[NSApplication sharedApplication]
delegate] managedObjectContext];
I thought that would work but when I instantiate the nib I get this
error:
Cannot perform operation without a managed object context
Maybe the NSArrayController is trying to do its thing before
awakeFromNib is called? In any case, that obviously isn't the right
way to do it either. Can anyone tell me how to get a reference to my
managed object context in my nib file?
Thanks
Mike
_______________________________________________
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