IOS development (104): Program Execution status change

Source: Internet
Author: User
1 Preface

In the previous section, we introducedProgramExecution status. From the example, we can find that there are clear policies to follow when processing these status changes. This time we will introduce it.

2. Details 2.1 activity-no activity

UseApplicationwillresignactive :/UiapplicationwillresignactivenotificationTo pause the display of the application. Ensure that timely user input is not required at work, because the application does not obtain any user input for a period of time.

2.2 No activity-"background

UseApplicationdidenterbackground :/Uiapplicationdidenterbackgroundnotification releases any resources that do not need to be retained when the application is in the background State (such as cached images or other data that can be easily loaded ), or any resources (such as network connections) that cannot be stored in the background ). This avoids excessive memory usage and reduces the final pause snapshot of the application, thus reducing the overall clear risk of the application from Ram. You can also use this opportunity to save any necessary application data, which will help you find the progress of the last exit at the next restart.

2.3 background-no activity

UseApplicationdidbecomeactive :/Uiapplicationdidbecomeactivenotification resume fromBackground statusSwitchInactive statusAny operations performed. For example, you can re-establish a persistent network connection here.

2.4 no activity-Activity

Use applicationdidbecomeactive :/Uiapplicationdidbecomeactivenotification restores any operations from activity to activity status. This method and notification are used when the application starts completely new, so any operations executed here must also be valid in this context.

Note: during this process, the system does not provide much time to save the changes here, but only provides 5 seconds. If it takes more than 5 seconds, the application will immediately be clear from the memory and enter the not running status!

3 conclusion

The above is all content and I hope it will help you.

 

Related Article

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.