From a4294241079351823367ce8237bdc93f69748910 Mon Sep 17 00:00:00 2001
From: yjajkiew <yann.jajkiewicz@capgemini.com>
Date: Thu, 15 Mar 2018 18:05:00 +0100
Subject: [PATCH] get real top most view controller

---
 src/ios/Toast+UIView.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ios/Toast+UIView.m b/src/ios/Toast+UIView.m
index 75e8872..aaf1f92 100644
--- a/src/ios/Toast+UIView.m
+++ b/src/ios/Toast+UIView.m
@@ -157,7 +157,7 @@ static id styling;
 }
 
 - (UIViewController*) getTopMostViewController {
-  UIViewController *presentingViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
+  UIViewController *presentingViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
   while (presentingViewController.presentedViewController != nil) {
     presentingViewController = presentingViewController.presentedViewController;
   }