Commit 1e664a67 authored by Chris Scott's avatar Chris Scott

Important to check for existing bgTask and abort, otherwise we're left with...

Important to check for existing bgTask and abort, otherwise we're left with outstanding unkilled bg-tasks, resulting in ios killing the app and filing a crash-report
parent 918ce967
...@@ -167,6 +167,12 @@ ...@@ -167,6 +167,12 @@
UIApplication *app = [UIApplication sharedApplication]; UIApplication *app = [UIApplication sharedApplication];
// Bail out if there's already a background-task in-effect.
if (bgTask != UIBackgroundTaskInvalid) {
NSLog(@" Abort: found existing background-task");
return;
}
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[self stopBackgroundTask]; [self stopBackgroundTask];
}]; }];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment