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.

log output

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.

here's similar answer


Comments

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -