I am attempting to use a dedicated UIWindow
for presenting UIAlertControllers
. Everything was going pretty well until I realized that the handlers on the UIAlertActions
attached to the UIAlertControllers
were not being fired if they were presented by a controller on this other UIWindow
.
If I present the UIAlertController
from any viewController on the main window the handlers are fired, if I present it from the rootViewController of the alert window the handlers are not fired.
Any hints as to what I may be experiencing here? Thanks!
Edit: Test Project illustrating the problem.
Solved: I forgot to call the completion block in my override of dismissViewControllerAnimated:completion:
in my alertWindowRootViewController subclass.
So it turns out that I was forgetting to call the completion block in my override of dismissViewControllerAnimated:completion
. Doh!
I have updated my Test Project to include the fix in hopes that this can be valuable to someone else.
I do like my solution more than Dylan Betterman's Solution since mine keeps a permanent window around that isn't associated with the lifecycle of the UIAlertController
. This means that you are allowed to keep strong pointers to the alert controllers unlike Dylan's solution.