Since I'm using iOS 13, each of my UIAlertController shows up for about half a second and disappears instantly before any user action. Any idea ?
As I use UIAlertController from different parts of my app, I use an extension that allows me to pop up both from classical views and collectionView (cell, header etc...)
public extension UIAlertController {
func show() {
let win = UIWindow(frame: UIScreen.main.bounds)
let vc = UIViewController()
vc.view.backgroundColor = .clear
vc.view.tintColor = Theme.mainAccentColor
win.rootViewController = vc
win.windowLevel = UIWindow.Level.alert + 1
win.makeKeyAndVisible()
vc.present(self, animated: true, completion: nil)
}
}
And here is an example of this extension use :
fileprivate func showMissingAlert() {
let alert = UIAlertController(title: "blablabla", message: "blablablablabla blabla", preferredStyle: UIAlertController.Style.alert)
alert.show()
alert.view.tintColor = Theme.mainAccentColor
let cancelAction = UIAlertAction(title: "OK, blabla", style: .default, handler: {(alert: UIAlertAction!) in print("ok, leave")})
alert.addAction(cancelAction)
}
And further in my code :
showMissingAlert()
Before iOS 13, every UIAlert worked fine... Since I moved to iOS 13, and even iOS 13.1, it became a big mess... :(
Any idea about what could cause this?
And how to prevent using UIAlert as subliminal message :) ?