iOS7 Background Transfers

As of iOS 7, Apple supports a method for downloading assets in the background, even when the app isn't active. Pugpig 2.2 has been updated to support using the background downloader. This will let you allow background downloading, even if you don't want to use Newsstand.

To enable background transfers, add this to your application delegate's init:

[KGDocumentManager setAllowBackgroundTransfers:YES];

You should also ensure that the appropriate background mode is enabled in your application capabilities (you must ensure “Background fetch” is checked). Pugpig does not support combining both Newsstand and Background fetch - you must pick one or the other.

Your app delegate must also forward the background download callback:

- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler {
  [KGDocumentManager handleEventsForBackgroundSession:identifier completionHandler:completionHandler];

Enabling background transfers will have no effect for older versions of iOS.

You can check if background transfers are currently enabled by checking the return value from

[KGDocumentManager allowBackgroundTransfers];
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk