summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Switzer <dswitzer@xevo.com>2017-03-29 16:00:40 -0700
committerDavid Switzer <dswitzer@xevo.com>2017-03-29 16:00:40 -0700
commitc5e3bda33087fb3db9f8fa6f5ae05ce1862d7f35 (patch)
treec5d7166ed52eb86be76917967aa65bcaf4b12d4f
parent74076eda3f0794d6e5b7a10348d0bc9c70496d02 (diff)
downloadsdl_ios-c5e3bda33087fb3db9f8fa6f5ae05ce1862d7f35.tar.gz
Fix logic flow in sdl_backgroundTaskStart to meet SDL guidelines.
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m11
1 files changed, 7 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m
index 279220245..b4e477083 100644
--- a/SmartDeviceLink/SDLIAPTransport.m
+++ b/SmartDeviceLink/SDLIAPTransport.m
@@ -89,12 +89,15 @@ int const streamOpenTimeoutSeconds = 2;
[SDLDebugTool logInfo:@"SDLIAPTransport Stopped Listening For Events"];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
+
- (void)sdl_backgroundTaskStart {
- if (self.backgroundTaskId == UIBackgroundTaskInvalid) {
- self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"SDLIAPConnectionLoop" expirationHandler:^{
- [self sdl_backgroundTaskEnd];
- }];
+ if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
+ return;
}
+
+ self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"SDLIAPConnectionLoop" expirationHandler:^{
+ [self sdl_backgroundTaskEnd];
+ }];
}
- (void)sdl_backgroundTaskEnd {