On Oct 27, 2008, at 1:49 PM, Jerry Krinock wrote:
- (NSManagedObjectContext*)managedObjectContext {
   if (![super managedObjectContext]) {
       // Create a new MOC...
       // Oops, sorry, this branch will never execute.
   }

   return [self managedObjectContext] ;
}

Won't this lead to infinite recursion? And why are you calling [super managedObjectContext] if the intent is to create your own MOC? It looks like this should be something like:

- (NSManagedObjectContext*)managedObjectContext {
   NSManagedObjectContext* moc = /* ... create your own MOC ... */;

   [self setManagedObjectContext:moc];

   return moc;
}

Or alternatively, if your intent is to use the inherited behavior but do some additional stuff to the MOC:

- (NSManagedObjectContext*)managedObjectContext {
   NSManagedObjectContext* moc = [super managedObjectContext];

   // ... Do custom stuff to moc ...

   return moc;
}

[Disclaimer: I don't know Core Data, I'm just going by a quick look at the docs and a guess at your possible intentions.]

--Andy

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to