diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-05-13 12:01:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-13 12:01:16 -0400 |
commit | 23182590f7544f869aa2591d44a3758055177ff7 (patch) | |
tree | dc70cfcaafcd363566ce63925e51a055286d5c18 | |
parent | 90b48bec6c589957fd83b37b97a660532f9eda02 (diff) | |
parent | 51e08134a0e1d70631432d1f526fdced86fa8a8d (diff) | |
download | sdl_ios-23182590f7544f869aa2591d44a3758055177ff7.tar.gz |
Merge pull request #1259 from smartdevicelink/bugfix/issue_1258_lockscreen_crash_2
Fix all crashes due to lockscreen being setup before app window
-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; } |