• 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: NSManagedObject class method error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSManagedObject class method error


  • Subject: Re: NSManagedObject class method error
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 8 Oct 2007 09:15:06 -0700

On Oct 8, 2007, at 8:40 AM, ad veloper wrote:

+ (Foo *)fooWithDefaultContext
{
return [NSEntityDescription insertNewObjectForEntityForName:@"Foo"
inManagedObjectContext:[[NSApp delegate] managedObjectContext]];
}

Are you sure that at the time this method is invoked, [NSApp delegate] returns a fully-configured delegate, and that delegate can return its managed object context?


If you're invoking this before your main nib file is loaded, and that's where your application's delegate is configured, that would explain what you're seeing.

  -- Chris

_______________________________________________

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: 
 >NSManagedObject class method error (From: "ad veloper" <email@hidden>)

  • Prev by Date: Re: Running Shell Script from Cocoa Application
  • Next by Date: Subclassing NSCell (was Re: Problem With implementing copyWithZone)
  • Previous by thread: Re: NSManagedObject class method error
  • Next by thread: Re: NSManagedObject class method error
  • Index(es):
    • Date
    • Thread