IPhone programming, end some of your research with code.

Source: Internet
Author: User

The cause is that some children's shoes posted a post on the Forum. The original post is as follows:

"In int retval = uiapplicationmain (argc, argv, nil, nil );
When the [pool drain] line is followed by a breakpoint, It is not executed when you press the Home key. Which one knows why?
You can execute a breakpoint in applicationwillterminate"

 

I did a lot of tests and checked them online. I found that they could not be done at all. Of course, if you have any good solutions, please let me know. Thank you first.

The experiment concluded as follows: (IOS 4 Environment)

1. There is only one way to end with code, and Apple does not recommend that you call the exit () function. There was a method in the uiapplication class before 2.0 that can be called, but now there is no more, and if you force to use the compiling environment before 2.0, Apple will reject you to publish this program to the app store.

2. After you press the Home key, the program is transferred to the background for running.

3. after pressing the Home Key twice in a row, a program list will appear under the iPhone screen. This list is a list of programs that I thought were transferred to the background for running, I am wrong. This is only a list of recently used programs, whether or not this program runs in the background. If you hold down one of the program icons for a while, when these icons begin to shake, a red minus sign will appear in the upper left corner of the icon, press this minus sign, the program will be cleared from the recently run list. If the program is still running in the background, the program will end.

4. added an option in info. plist. "Application does not run in background". If you have added and selected this item, after you press the Home key, the program will not be transferred to the background for running and will be killed directly.

5. No matter which method is used to kill the program, applicationwillterminate will be called.

 

This is the result of my experiment. I hope it will be useful to you. If my results are incorrect or there are better methods, please do not give me any further advice. Thank you!

 

 

 

 

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.