Re: how to get a managedObjectContext in a nib file
Re: how to get a managedObjectContext in a nib file
- Subject: Re: how to get a managedObjectContext in a nib file
- From: Sean Kline <email@hidden>
- Date: Wed, 2 Sep 2009 10:16:03 -0400
To what entity is your Array Controller bound? (just checking to see if you
did this...forgive the question if it is too basic)
On Wed, Sep 2, 2009 at 7:53 AM, Michael Thon <email@hidden> wrote:
> 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
>
_______________________________________________
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