首页 > 移动平台 > 详细

iOS __attribute__((constructor))

时间:2016-10-02 17:04:46      阅读:379      评论:0      收藏:0      [点我收藏+]

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函数

 

iOS __attribute__((constructor))

原文:http://www.cnblogs.com/wxm5558/p/5927569.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!