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