iOS app life cycle

Source: Internet
Author: User

5 Status of iOS apps

The Not Running (non-running) app is not running or terminated by the system.

Inactive (foreground inactive) app is entering foreground state, but cannot accept event handling.

The active (foreground active status) app enters the foreground state and can accept event handling.

After the Background (background state) application enters the background, the code can still be executed. If you have executable code, you execute the code.

Suspended (hangs) a self-suspending application enters a "frozen" state and cannot execute code. If the system does not have enough memory, the application is terminated.

Second, the iOS application state changes the corresponding method description

Method Local notifications Description
Application:didfinishlaunchingwithoptions: Uiapplicationdidfinshlaunchingnotification The method is invoked and notified when the app is started and initialized. This stage instantiates the root view controller
Applicationdidbecomeactive Uiapplicationdidbeconmeactivenotification The method is called and notified when the app enters the foreground and is active. This stage can restore the UI state (e.g. game state, etc.)
Applicationwillresignactive Uiapplicationwillresignactivenotification The method is called when the app is from active state to inactive state and is notified. This stage can save the UI state (such as game state, etc.)
Applicationdidenterbackground Uiapplicationdidenterbackgroundnotificaiton The method is called and notified when the app enters the background. This stage can save the user data, release some resources (such as freeing up the database resources, etc.)
Applicationwillenterforeground Uiapplicationwillenterforegroundnotification The method is called and notified when the app enters the foreground, but is not yet active. This phase can restore the data user
Applicationwillterminate Uiapplicationwillterminatenotification The method is called when the app is terminated, except when the memory is cleared. This phase frees up some resources and can also save user data

iOS app 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.