Today, due to the requirements of the project: the software in the background countdown, after the end of the jump to B interface, a simple understanding of the program into the background of several methods and several states of the program

Several states of a program

Stopped – The application has been terminated (removed from task Manager) or has not been started.

Inactive – The application is in the foreground but no longer receives events (e.g., locked device, answered phone).

Active – App is in the “in Use” state.

Back-app is no longer displayed on the screen, but it still executes the code.

Suspended -app still resides in memory but no longer executes code.

When you press the Home button, your app goes from active to background, and most apps go from background to suspended, usually within seconds.

Two background several methods


Above we know several states of the program, we are going to talk about suspended programs, enter the background, the official gave the following methods




Background Modes

Corresponding to: background audio; Background positioning; Background voice service; Download updates; Background Task Completion (I’ll cover that in a second); Use Bluetooth; As a Bluetooth object; Background information update; Message push;

Background Task Completion: This interface has been available since iOS 4, and can be used by any type of APP. However, in the old system, the Background limit of this interface is only 10 minutes, meaning that when the APP is dropped back into the Background, it will run for only 10 minutes before going to sleep. IOS 7 gave a change to the interface, the original is for 10 minutes, namely whether or not you 10 minutes the user to shut down the screen to enter a dormant state, the application will still be waiting for 10 minutes in the background is introduced, and the new improved as if encounter closed screen dormancy, the background of 10 minutes will follow sleep together, The remaining background time will be calculated after the user wakes up the device again. The background running time is still 10 minutes, but it is not continuous, which has the advantage of saving power.

Three Solutions

Method 1: use background audio playback method, if you do not have this need but want to use this method, you can play silent music!

The header file:




The header file




Background audio method

There is no detailed introduction to the use of network video, including, the previous one, the next one, after all, the theme is to introduce the program into the background

Method two background positioning




The background to locate

And then — — — — — –




Check the corresponding method

— — — — — – in the end




Plist add

Plist adds an array named :Required Background Modes array element to add the corresponding description

App Plays audio or Streams audio/video using AirPlay

2: App registers for location updates




At present, I have looked at these two, they are relatively simple, and I will continue to update the other ones in the later period. If there are any deficiencies, welcome to correct them!

Programming is a long road, the way forward with you will be more wonderful, thank you!