Find some code about the iOS background where you can continue to perform tasks, share:
First, you need to configure the Info-plist file, create a new required background modes inside. This is an array, where the following is added:
APP provides Voice over IP services (VOIP)
APP plays audio or streams audio/video using AirPlay (audio)
APP processes Newsstand Kit downloads (newsstand-content)
APP communicates using Corebluetooth ( bluetooth-central
)
APP shares data using Corebluetooth ( bluetooth-peripheral
)
APP Registers for location updates
After adding, add the following code in-(void) Applicationdidenterbackground: (uiapplication *) application
- __block Uibackgroundtaskidentifier Background_task;
- Background_task = [Application beginbackgroundtaskwithexpirationhandler:^ {
- [Application Endbackgroundtask:background_task];
- Background_task = Uibackgroundtaskinvalid ;
- }];
- Dispatch_async (Dispatch_get_global_queue (dispatch_queue_priority_default, 0), ^{
- while (TRUE)
- {
- [Nsthread sleepfortimeinterval:1];
- Writing execution Task code
- }
- [Application Endbackgroundtask:background_task];
- Background_task = Uibackgroundtaskinvalid ;
- });
IOS Background Unlimited tasks