• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data debugging (Fritz Anderson)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Core Data debugging (Fritz Anderson) (From: email@hidden)

  • Prev by Date: ibtool and genstrings do nothing
  • Next by Date: Re: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
  • Previous by thread: Re: Core Data debugging (Fritz Anderson)
  • Next by thread: movieFileTypes, imageFileTypes and Info.plist's
  • Index(es):
    • Date
    • Thread