diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-01-29 16:23:44 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-01-29 16:23:44 -0500 |
commit | c59fd12ecda103f105103bcf7a1741dc3b2deb18 (patch) | |
tree | 1396340560c6dbf2d228825cff318b6ad2338302 | |
parent | 882aa24b31f92119f600a8fdc0b50dca7dec1d71 (diff) | |
download | sdl_ios-c59fd12ecda103f105103bcf7a1741dc3b2deb18.tar.gz |
Fix #852bugs/issue_852_main_thread
* Fix application state should not be called off of main thread
-rw-r--r-- | SmartDeviceLink/SDLProxy.m | 9 |
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); |