I am trying to show a UIAlertController over a UISplitViewController. I have tried everything that I have found on this site, and am sticking with an extension found here.
extension UIAlertController {
func presentInOwnWindow(animated: Bool, completion: (() -> Void)?) {
let alertWindow = UIWindow(frame: UIScreen.main.bounds)
alertWindow.rootViewController = UIViewController()
alertWindow.windowLevel = UIWindowLevelAlert + 1;
alertWindow.makeKeyAndVisible()
alertWindow.rootViewController?.present(self, animated: animated, completion: completion)
}
I get an exception immediately after present executes, and I can't see the stack trace and the exception breakpoint is not fired.
libc++abi.dylib: terminating with uncaught exception of type NSException
It presents fine on a phone with the UISplitViewController collapsed. What am I missing?