In previous versions of iOS I was able to call show
on a UIAlertView in the App Delegate. More specifically, show
was called in:
func applicationDidBecomeActive(application: UIApplication)
Since UIAlertView
s disregarded the view hierarchy in most cases, this solution worked no matter where the user was in the app.
With the introduction of UIAlertController
this problem becomes a little trickier. UIAlertController
is now a subclass of UIViewController
and needs to be presented just like any other UIViewController. While presenting the UIAlertController from the keyWindow's rootViewController works, it's not the ideal solution.
Does anyone have any ideas on replicating [UIAlertView show]
functionality for a UIAlertController
? Any way to show the UIAlertController
on app active without traversing the view hierarchy?
show
with a parameter that passes UIViewController? Then call that method from any view controller and passself
. – brandonscriptUIViewController
is showing without traversing the view hierarchy, so simply usingUIAlertView show
worked well. – Dylan Bettermann