Fixing a bug where finding the right window wouldn't work.

Now, even if you call rateApp() from a UIActionSheet, it will actually present the modal.
This commit is contained in:
Peter Livesey
2014-11-23 12:30:33 -08:00
parent 4e077db6d2
commit 4e92562547
+6 -3
View File
@@ -1597,16 +1597,19 @@ public class Manager : ArmchairManager {
} }
private func getRootViewController() -> UIViewController? { private func getRootViewController() -> UIViewController? {
if let window = UIApplication.sharedApplication().keyWindow { if var window = UIApplication.sharedApplication().keyWindow {
if window.windowLevel != UIWindowLevelNormal { if window.windowLevel != UIWindowLevelNormal {
var windows: NSArray = UIApplication.sharedApplication().windows var windows: NSArray = UIApplication.sharedApplication().windows
for window in windows { for candidateWindow in windows {
if window.windowLevel == UIWindowLevelNormal { if let candidateWindow = candidateWindow as? UIWindow {
if candidateWindow.windowLevel == UIWindowLevelNormal {
window = candidateWindow
break break
} }
} }
} }
}
for subView in window.subviews { for subView in window.subviews {
var nextResponder: UIResponder? = subView.nextResponder() var nextResponder: UIResponder? = subView.nextResponder()