I created a code sample to re-download the file from the network (every 30 seconds or so). In iOS 7 using background transfer services using NSURLSession
I followed this tutorial http://mobile.tutsplus.com/tutorials/iphone/ios-7-sdk-background-transfer-service/
and added this timer to repeat it.
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
mute = [NSTimer scheduledTimerWithTimeInterval:30.0f
target:self
selector:@selector(startDownload)
userInfo:nil
repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:mute forMode:NSRunLoopCommonModes];
When I run it (in the background by pressing the home button) in the simulator and on the iPad connected to Xcode (where I can see the logs), everything works fine and it constantly loads. But when I disconnect the iPad from the Mac and launch it on the iPad in the background after about 3 seconds, it stops working (handleEventsForBackgroundURLSession in AppDelegate is called).
In the capabilities of the Xcode project, I chose Background fetch as the background modes.
What am I missing here or what did I do wrong to stop him after about 3 minutes? (According to the documents with the services of iOS 7 "Background Translation", it should work continuously, since there is no background for the background for this.)
thanks
Madhu source
share