One solution is to refuse to use [] to send a message using IMP instead:
- (id)init { self = [super init]; if (! self) return nil;
Or, if you do not want subclasses to see this method at all, make a file scope function instead:
static void customInit(Super *self) { } - (id)init { self = [super init]; if (self) customInit(self); return self; }
Keep in mind that if you are developing Apple platforms, then you should not use the underscore as a prefix to indicate that the method is private: Apple reserve is an agreement . Otherwise, you may inadvertently override Apple's private method.
user557219
source share