From 8a17777c7e325429154e0e883bd6f91f1769fdd7 Mon Sep 17 00:00:00 2001 From: Stefan Haubold Date: Wed, 4 Dec 2013 21:12:59 +0100 Subject: [PATCH] improved logic to choose right window to show dialogs in --- Classes/BITHockeyBaseManager.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index 9614ecefa8..e3899c79ce 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -162,7 +162,11 @@ } - (UIWindow *)findVisibleWindow { - UIWindow *visibleWindow = nil; + UIWindow *visibleWindow = [UIApplication sharedApplication].keyWindow; + + if (!(visibleWindow.hidden)) { + return visibleWindow; + } // if the rootViewController property (available >= iOS 4.0) of the main window is set, we present the modal view controller on top of the rootViewController NSArray *windows = [[UIApplication sharedApplication] windows]; @@ -171,7 +175,7 @@ visibleWindow = window; } if ([UIWindow instancesRespondToSelector:@selector(rootViewController)]) { - if ([window rootViewController]) { + if (!(window.hidden) && ([window rootViewController])) { visibleWindow = window; BITHockeyLog(@"INFO: UIWindow with rootViewController found: %@", visibleWindow); break;