Program startup process: The main function executes a uiapplicationmain this function int main (int argc, char * argv[]) {@autoreleasepool {
Return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Appdelegate class]));
}}intuiapplicationmain (int argc, char*argv[], NSString *principalclassname, NSString *delegateclassname) Principalclassname: Specifies the application class name (symbol of the app), which must be uiapplication (or subclass). If nil, the UIApplication class is used as the default value Delegateclassname: Specifies the proxy class for the application, This class must comply with the Uiapplicationdelegate protocol Uiapplicationmain implementation of the underlying: 1. Create a UIApplication object based on the class name provided by Principalclassname 2. Based on the Delegateclassname class name The delegate object and assigns a value to the delegate property of the UIApplication object. 3. The application:didfinishlaunchingwithoptions of the delegate object is called first after the program finishes: Method 4. Build the Mainloop event loop of the application, handle the event (constantly traversing, constantly take the event from the event queue, and each event of the app will be added to the queue) (4. Load the Info.plist file and parse it to see if the specified Main.storyboard file is loaded if specified. 5. When the program exits normally, it returns
iOS program startup process