Swiftiosapp life cycle

Source: Internet
Author: User

Application proxy class (Appdelegate):

AppDelegateclass defines the callback method when the app enters a different life cycle, including app startup, Idle, backstage, entry foreground, active, and full exit. In fact, when the app launches, the app automatically executes a called main entry function that creates an instance of the class by calling the UIApplicationMain function AppDelegate and delegating it to implement the app's custom behavior over different lifecycles.

The status of the application is as follows:

Not running (not running) program does not start

The Inactive (inactive) program runs in the foreground , but does not receive an event . In the absence of event handling, the program usually stays in this state

The active (active) program runs in the foreground and receives events . This is also a normal mode of the front desk

The backgroud (background) program is in the background and can execute code , and most programs will stay in this state for a while after entering this state. The time will then go into the suspended state (Suspended). Some programs can be in Backgroud state for a long time after special request

The Suspended (pending) program cannot execute code in the background . The system automatically turns the program into this state and does not give notice. When suspended, the program is still in memory, when the system memory is low, the system will remove the suspended program, to provide more memory for the foreground program.

Callback for the agent when each program is running state:

1. Application didfinishlaunchingwithoptions: When the application starts, the application starts the portal and executes only once when the application starts. If the user launches directly, no data in lauchoptions, if the application is launched by other means, Lauchoptions contains the content of the corresponding method.

2. Applicationwillresignactive: When the application is going to be switched from active to inactive, the delegate calls to be performed , such as pressing the home button, returning to the home screen, or switching the application between the full screen, etc.

3. Applicationdidenterbackground: The delegate call to execute when the application has entered the daemon .

4, Applicationwillenterforeground: When the application will enter the foreground (is activated), to execute the delegate call, just as the Applicationwillresignactive method corresponds.

5, Applicationdidbecomeactive: After the application has been activated, the delegate call to be executed , just corresponding to the Applicationdidenterbackground method.

6, Applicationwillterminate: When the application is to be fully launched, to execute the delegate call, this need to set the Uiapplicationexitsonsuspend key value.

Swiftiosapp life cycle

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.