开发者

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 c开发者_开发问答an'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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜