dontWatchMyProfile
dontWatchMyProfile

Reputation: 46400

Which methods are good to override when creating custom NSManagedObject subclasses?

The Core Data Programming Guide talks a lot about what not to override. So the question is: What is good to override?

Like I see it, I can't override -init or -initWithEntity:insertIntoManagedObjectContext:

So where else would be a good override point to set up some basic stuff? Or is it generally not needed to do custom initialization? Does the whole thing rely only on accessing properties which then start to do fancy things? So no custom initializations?

Upvotes: 0

Views: 225

Answers (1)

Martin Brugger
Martin Brugger

Reputation: 3158

I often override the following methods:

-(void) awakeFromFetch
-(void) awakeFromInsert
-(void) willTurnIntoFault
-(void) didTurnIntoFault

Don't forget to call super implementations. In Addition the following method should be overridden to process Objects after undo/redo

- (void)awakeFromSnapshotEvents:(NSSnapshotEventType)flags

ADC

Upvotes: 2

Related Questions