From e19ea17714381b2c33265a3bbd8d5afc04f39d19 Mon Sep 17 00:00:00 2001 From: Bigood Date: Wed, 4 Nov 2015 16:36:46 +0100 Subject: [PATCH] Give the background view a rootViewController Fix the "Applications are expected to have a root view controller at the end of application launch" in iOS 9 - it worked fine without it in prior versions, hence the version control. Fixes issue #110 : https://github.com/Sumi-Interactive/SIAlertView/issues/110 --- SIAlertView/SIAlertView.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SIAlertView/SIAlertView.m b/SIAlertView/SIAlertView.m index 7a67df3..6fc5738 100644 --- a/SIAlertView/SIAlertView.m +++ b/SIAlertView/SIAlertView.m @@ -308,6 +308,12 @@ + (void)showBackground __si_alert_background_window = [[SIAlertBackgroundWindow alloc] initWithFrame:frame andStyle:[SIAlertView currentAlertView].backgroundStyle]; + + //Fix the "Applications are expected to have a root view controller at the end of application launch" + //in iOS 9 - it worked fine without it in prior versions, hence the version control + if (floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_8_3) + __si_alert_background_window.rootViewController = [UIViewController new]; + [__si_alert_background_window makeKeyAndVisible]; __si_alert_background_window.alpha = 0; [UIView animateWithDuration:0.3