diff options
author | David Switzer <dswitzer@xevo.com> | 2017-03-29 16:00:40 -0700 |
---|---|---|
committer | David Switzer <dswitzer@xevo.com> | 2017-03-29 16:00:40 -0700 |
commit | c5e3bda33087fb3db9f8fa6f5ae05ce1862d7f35 (patch) | |
tree | c5d7166ed52eb86be76917967aa65bcaf4b12d4f | |
parent | 74076eda3f0794d6e5b7a10348d0bc9c70496d02 (diff) | |
download | sdl_ios-c5e3bda33087fb3db9f8fa6f5ae05ce1862d7f35.tar.gz |
Fix logic flow in sdl_backgroundTaskStart to meet SDL guidelines.
-rw-r--r-- | SmartDeviceLink/SDLIAPTransport.m | 11 |
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 { |