Siren: Blocking UI when the alert is dismissed

I removed the predefined text because this behaviour can be seen in the Example app too.

Steps to reproduce:

  1. Click on the Example project in the Project Navigator. In the Targets select Example if it is not selected.
  2. Under General tab, under Deployment Info change the Main interface option to Main.storyboard .
  3. Open the Main.storyboard in the Supporting Files group/folder.
  4. Put UISwitch in the scene and add constraints to it.
  5. Run the application in simulator. After the popup for update appears and the user taps on something, the user can’t flip the switch. If you comment the line annoyingRuleExample() in the application(_:didFinishLaunchingWithOptions:), and run the app again the user can flip the switch.

I tested it with the newest version (5.2.2) and this behaviour is happening to me in the simulator and on real device too. I don’t know if it has something to do with the UIWindow the alert creates because after dismissal the window for the alert is still there in the view hierarchy.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I think the code below fixes it:

if #available(iOS 13.0, *) {
          if let windowScene = self.updaterWindow.windowScene {
            for window in windowScene.windows where window.rootViewController != nil && window.rootViewController! is SirenViewController {
              window.rootViewController = nil
              window.resignKey()
              window.removeFromSuperview()
            }
          }
          self.updaterWindow.windowScene = nil
        }

@ibeleliev Tested this on my app, didn’t notice any issues here.

I can confirm that writing this

        if #available(iOS 13, *) {
            UIApplication.shared.keyWindow?.windowScene = nil
        }

in the end of the cleanup function fixes the issue in the example app. Since im really not sure if i should use UIApplication in the library code i’m not gonna do PR 😃

Can one of you see if nuking/nilling-out the window scene in the cleanup() method fixes the issue? I’m a bit indisposed until later tonight / tomorrow to be able to check.

Sent with GitHawk