My iOS app doesn’t run in background. When home button is hit the app will terminate.
Below is my code
- (void)applicationDidEnterBackground:(UIApplication *)application
{
double sleepTime = [[UIApplication sharedApplication] backgroundTimeRemaining] - 1;
[self performTaskforTime:sleepTime];
}
If the application is relaunched in no time, the New instance of the app will killed with the error :
Exception Type: 00000020 Exception Codes: 0x8badf00d Highlighted
Thread: 0Application Specific Information: My_App failed to launch in time
I can’t reduce the sleep time. Is there any solution for this?
You need to return from
- (void)applicationDidEnterBackground:(UIApplication *)application, do something like this:You don’t want to block the main queue with a long running task as you won’t be able to service the UI otherwise. Your application is busy with
-performTaskforTime:and thus can’t launch in time.