Re: Core Data debugging (Fritz Anderson)
Re: Core Data debugging (Fritz Anderson)
- Subject: Re: Core Data debugging (Fritz Anderson)
- From: mmalc Crawford <email@hidden>
- Date: Thu, 16 Jul 2009 14:53:46 -0700
On Jul 16, 2009, at 12:51 PM, email@hidden wrote:
I have removed it completely and just called the longer winded
[[NSApp delegate] managedObjectContext] when I need it. I suppose I
could have set the ivar in the awakeFromNib when all NIB objects are
guaranteed to have been instantiated.
In general, you are discouraged from retrieving resources such as this
from the application delegate. Instead, you should pass resources
directly to view controllers. This is the pattern shown in the Core
Data templates and related sample code, e.g.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
RootViewController *rootViewController = (RootViewController *)
[navigationController topViewController];
rootViewController.managedObjectContext =
self.managedObjectContext;
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
This typically makes your view controllers more self-contained and
reusable.
mmalc
_______________________________________________
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