diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-05-09 10:49:09 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2019-05-09 10:49:09 -0400 |
commit | 51e08134a0e1d70631432d1f526fdced86fa8a8d (patch) | |
tree | dc70cfcaafcd363566ce63925e51a055286d5c18 | |
parent | 90b48bec6c589957fd83b37b97a660532f9eda02 (diff) | |
download | sdl_ios-51e08134a0e1d70631432d1f526fdced86fa8a8d.tar.gz |
Fix all crashes due to lockscreen being setup before the app windowbugfix/issue_1258_lockscreen_crash_2
-rwxr-xr-x | SmartDeviceLink/SDLScreenshotViewController.m | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLScreenshotViewController.m b/SmartDeviceLink/SDLScreenshotViewController.m index 8a817e51d..9ac5f4a8c 100755 --- a/SmartDeviceLink/SDLScreenshotViewController.m +++ b/SmartDeviceLink/SDLScreenshotViewController.m @@ -32,12 +32,12 @@ return self; } - // HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250 +// HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250 - (UIInterfaceOrientationMask)supportedInterfaceOrientations { UIViewController *viewController = [self sdl_topMostControllerForWindow:[UIApplication sharedApplication].windows[0]]; if (viewController == self) { - @throw [NSException sdl_invalidLockscreenSetupException]; + return UIInterfaceOrientationMaskAll; } else if (viewController != nil) { return viewController.supportedInterfaceOrientations; } @@ -45,21 +45,23 @@ return UIInterfaceOrientationMaskAll; } - // HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250 +// HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250 - (BOOL)shouldAutorotate { UIViewController *viewController = [self sdl_topMostControllerForWindow:[UIApplication sharedApplication].windows[0]]; - if (viewController != nil) { + if (viewController == self) { + return YES; + } else if (viewController != nil) { return viewController.shouldAutorotate; } - return super.shouldAutorotate; + return YES; } - (UIViewController *)sdl_topMostControllerForWindow:(UIWindow *)window { UIViewController *topController = window.rootViewController; - while (topController.presentedViewController) { + while (topController.presentedViewController != nil) { topController = topController.presentedViewController; } |