I would like to override awakeFromFetch
and awakeFromInsert
.
As I leave the auto-generated NSManagedObject
subclasses unchanged and put my custom code in categories, my question is:
Where do I put awakeFromFetch
and awakeFromInsert
in order that these methods get called correctly?
If your managed object subclass files are generated by Xcode, then you can also put the methods in a category of the managed object subclass, so that the code is not overwritten when you re-generate the class files in Xcode.
MyEntity+Extensions.h
#import "MyEntity.h"
@interface MyEntity (Extensions)
@end
MyEntity+Extensions.m
#import "MyEntity+Extensions.h"
@implementation MyEntity (Extensions)
- (void)awakeFromFetch
{
}
- (void)awakeFromInsert
{
}
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With