关于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
做难事必有所得