iOS __attribute__((constructor))

iOS里面测试几个函数

__attribute__((constructor)) static void startup()

{

    printf("startup xxx \n");

}

 

__attribute__((destructor)) static void finishup()

{

    printf("finishup xxx \n");

}

 

- (void)dealloc

{

    NSLog(@"dealloc xxx");

}

 

app启动起来会先调用 constructor,即使是没有进入对应的页面

退出页面会调用dealloc

杀掉app后会调用destructor函数

 

posted on 2016-10-02 15:29  wxm5558  阅读(602)  评论(0编辑  收藏  举报