Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. - (void)applicationDidEnterBackground:(UIApplication *)application
  2. {
  3. // 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.
  4. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  5.  
  6. NSLog(@"%s", __FUNCTION__);
  7.  
  8. __block UIBackgroundTaskIdentifier task = [application beginBackgroundTaskWithExpirationHandler:^{
  9.  
  10. NSLog(@"Expiration handler called %f",[application backgroundTimeRemaining]);
  11. [application endBackgroundTask:task];
  12. task = UIBackgroundTaskInvalid;
  13. }];
  14.  
  15. [NSThread sleepForTimeInterval:2.0];
  16. [application endBackgroundTask:task];
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement