App runs in the background

Source: Internet
Author: User

There are three states of the app:

1. Death status (app not open);

2. Foreground running status (open state);

3. Background pause status (stop all animations, timers, multi-media networking, etc.)

4. Background running status (background running); ---------

Need to be set in Appdelegate:

1. Set in-(void) Applicationdidenterbackground: (UIApplication *) Application Method:

  

-(void) Applicationdidenterbackground: (uiapplication *) Application {

It is uncertain how long it will take to apply for background running to the operating system.

[Application beginbackgroundtaskwithexpirationhandler:^{

}];

so: If you want to keep the program running in the background, you need to set it up:  

The ability to apply for background runs to the operating system, how long it can last, is uncertain

Uibackgroundtaskidentifier task = [Application beginbackgroundtaskwithexpirationhandler:^{

When the background run time for the application has ended (expired), the block is called

Finish the mission.

[Application Endbackgroundtask:task];

}];

Setting the background mode in INFO.PLST: Required background modes = = APP plays audio or streams audio/video using AirPlay

//engage in a 0kb MP3 file with no sound, Loop Playback

There are only 3 types of previous background modes

Keep your network connected

Multimedia applications

VOIP: Internet telephony

}

App runs in the background

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.