objective c - iOS - method (in another class) executed twice -
i'm calling appcontroller
viewcontroller
upon viewdidload
@implementation viewcontroller - (void)viewdidload { [super viewdidload]; nslog(@"viewdidload"); [appcontroller initialize]; } @end @implementation appcontroller + (void)initialize { nslog(@"initialize"); } @end
i expected initialize
executed once. but, seen in console, it's executed twice.
is bug or missing something?
+ (void)initialize method called objective-c runtime first time class referenced.
you should never call yourself, , never call super.
if you're looking setup on data controller override init.
Comments
Post a Comment