summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-02-06 11:22:16 -0500
committerGitHub <noreply@github.com>2018-02-06 11:22:16 -0500
commitb8a7ef6396e59447b7de48f4f846053a0947913c (patch)
tree2aa0d217e1c1936c4c5f1cae9bfec85326abd834
parent8975c9654f38552518f608045354209111d39bcf (diff)
parentc59fd12ecda103f105103bcf7a1741dc3b2deb18 (diff)
downloadsdl_ios-b8a7ef6396e59447b7de48f4f846053a0947913c.tar.gz
Merge pull request #854 from smartdevicelink/bugs/issue_852_main_thread
Fix application state should not be called off of main thread
-rw-r--r--SmartDeviceLink/SDLProxy.m9
1 files changed, 7 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m
index 30e96c354..24301c412 100644
--- a/SmartDeviceLink/SDLProxy.m
+++ b/SmartDeviceLink/SDLProxy.m
@@ -119,6 +119,12 @@ static float DefaultConnectionTimeout = 45.0;
#pragma mark - Application Lifecycle
- (void)sendMobileHMIState {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self sdl_sendMobileHMIState];
+ });
+}
+
+- (void)sdl_sendMobileHMIState {
UIApplicationState appState = [UIApplication sharedApplication].applicationState;
SDLOnHMIStatus *HMIStatusRPC = [[SDLOnHMIStatus alloc] init];
@@ -133,8 +139,7 @@ static float DefaultConnectionTimeout = 45.0;
case UIApplicationStateInactive: {
HMIStatusRPC.hmiLevel = SDLHMILevelBackground;
} break;
- default:
- break;
+ default: break;
}
SDLLogD(@"Mobile UIApplication state changed, sending to remote system: %@", HMIStatusRPC.hmiLevel);