关于load方法加载时间问题

#import <Foundation/Foundation.h>

 @interface XXObject :NSObject

 @end

 @implementation XXObject

 +(void)load{

    NSLog(@"XXObject load");

}

@end

int main(int argc, const char * argv[]) {

    @autoreleasepool {

        // insert code here...

        NSLog(@"Hello, World!");

    }

    return 0;

}

//运行结果:(显然先执行load 方法)

2017-05-19 10:41:51.090320 LoadTest[99069:13403889] XXObject load

2017-05-19 10:41:51.095309 LoadTest[99069:13403889] Hello, World!

Program ended with exit code: 0

posted @ 2017-05-19 11:12  do+better  阅读(494)  评论(0编辑  收藏  举报