Re: NSController controllerEditor:didCommit:… exception
Re: NSController controllerEditor:didCommit:… exception
- Subject: Re: NSController controllerEditor:didCommit:… exception
- From: Vincent Habchi <email@hidden>
- Date: Mon, 15 Nov 2010 14:32:30 +0100
Kyle:
> The main menu nib is kind of funny. It's loaded differently (or at
> least at a different time) than the other nibs. It's much more
> sensitive to timing issues like this.
>
> Who provides the MOC for the controller (another object in the nib?),
> and how is it provided (bindings, -setManagedObjectContext:)?
Yes, the MOC is provided through a binding to the AppController, itself part of the NIB. But the MOC iVar is set to nil until the user successfully opens a persistent store file. So I imagine the init code for the NSArrayController protests against finding a MOC set to nil. But since I don't actually need the array before the MOC is initialized, ignoring the exception it raises does not lead to a fatal error.
I worked around this annoyance by opening a temporary MOC. I imagine I could also decide to remove the controller from the NIB and create it programmatically only when a proper store is opened.
Cheers and thanks for help!
Vincent_______________________________________________
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