入口函數(shù)解析:
@autoreleasepool {
? ? ? ?return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
// 第三個參數(shù):UIApplication類名或者子類名稱,其中nil=@"UIApplication
// 第四個參數(shù):UIApplication的代理的名稱
NSStringFromClass:可以把類名轉(zhuǎn)換成字符串缠劝,使用NSStringFromClass的好處:
1)有提示功能 2)避免輸入錯誤.
也可以使用:
return UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");
Discussion
This function instantiates the application object from the principal class and instantiates the delegate (if any) from the given class and sets the delegate for the application. It also sets up the main event loop, including the application’s run loop, and begins processing events. If the application’s Info.plist file specifies a main nib file to be loaded, by including the NSMainNibFile key and a valid nib file name for the value, this function loads that nib file.