Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
- (void)applicationDidEnterBackground:(UIApplication *)application
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
NSLog(@"%s", __FUNCTION__);
__block UIBackgroundTaskIdentifier task = [application beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"Expiration handler called %f",[application backgroundTimeRemaining]);
[application endBackgroundTask:task];
task = UIBackgroundTaskInvalid;
[NSThread sleepForTimeInterval:2.0];
[application endBackgroundTask:task];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.