NSManagedObjects behave differently to NSObjects on many levels. If you’d like to add custom start-up behaviour in your NSManagedObjects, you’ll have noticed that overriding the standard init method isn’t working.
Instead, we can use the awakeFromFetch method. This is called automatically when a managed object is retrieved from the Core Data stack:
- (void)awakefrom {
[super awakeFromFetch];
// add custom behaviour here
}
Use this to set default values or initialise methods in your NSManagedObject classes.