iOS program start-up process

Source: Internet
Author: User

Uiapplicationmain

A uiapplicationmain function is executed in the main function.

int uiapplicationmain (int argc, char *argv[], nsstring *principalclassname, NSString *delegateclassname);
ARGC, argv: direct transfer to Uiapplicationmain for related processing can be

Principalclassname: Specifies the application class name (symbol of the app), which must be uiapplication (or subclass). If nil, use the UIApplication class as the default value

Delegateclassname: Specifies the application's proxy class, which must comply with the Uiapplicationdelegate protocol

The Uiapplicationmain function creates a UIApplication object based on Principalclassname and creates a delegate object from Delegateclassname. and assigns the delegate object to the delegate property in the UIApplication object

The application's main Runloop (the event loop) is then created, and the event is processed (the application:didfinishlaunchingwithoptions of the delegate object is called first after the program is completed: method)

The Uiapplicationmain function returns when the program exits normally

when the program starts, it executes the main function, which has the following actions in the main function.
int main (int argc, char * argv[]) {
@autoreleasepool {
Third parameter: UIApplication class name or subclass name nil = = @ "UIApplication"
Fourth parameter: proxy name of the uiapplication agent
Nsstringfromclass: Converting a class name to a string
Nsstringfromclass Benefits: 1. Prompt function 2. Avoid input errors
return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Appdelegate class]));
}
}

program Complete START process
1. Execute main
2. Execute the Uiapplicationmain function.
3. Create the UIApplication object and set the proxy for the Uiapplicationmain object.
the third parameter of UIApplication is the name of UIApplication, which defaults to uiapplication if it is specified as nil.
The fourth parameter of uiapplication is the proxy for uiapplication.
4. Turn on a main run cycle. Ensure that the application does not exit.
5. Load the info.plist. Load the configuration file. Determine if there is a info.plist file with the main storyboard filename base name
There is no specified storyboard file, if any, to load the Info.plist file, if not, then the application load is complete.

iOS program start-up process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.