Geen omschrijving

AWSTMCacheBackgroundTaskManager.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // TMCacheBackgroundTaskManager.h
  3. // TMCache
  4. //
  5. // Created by Bryan Irace on 4/24/15.
  6. // Copyright (c) 2015 Tumblr. All rights reserved.
  7. //
  8. #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0
  9. #import <UIKit/UIKit.h>
  10. #else
  11. typedef NSUInteger UIBackgroundTaskIdentifier;
  12. #endif
  13. /**
  14. A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
  15. order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
  16. */
  17. @protocol AWSTMCacheBackgroundTaskManager <NSObject>
  18. /**
  19. Marks the beginning of a new long-running background task.
  20. @return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
  21. mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
  22. */
  23. - (UIBackgroundTaskIdentifier)beginBackgroundTask;
  24. /**
  25. Marks the end of a specific long-running background task.
  26. @param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
  27. */
  28. - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;
  29. @end