I have some code that presents an alert to the user with information they need, and an OK button to clear it. It works fine in the previous Xcode versions. However, after upgrading to 11, it now displays the alert and then immediately clears it. This happens both in the simulator and on a real device. I have played around with the code and can't figure out how to make it leave the alert on the screen. This is in Swift. It is a function that is called from numerous places in the app.
func NotificationAlert (_ msg1: String, _ msg2: String) { let ErrorAlert = UIAlertController(title: msg1, message: msg2, preferredStyle: .alert) let dismiss = UIAlertAction(title: "Ok", style: .default, handler: nil) ErrorAlert.addAction(dismiss) ErrorAlert.presentInOwnWindow(animated: true, completion: nil) } extension UIAlertController { func presentInOwnWindow(animated: Bool, completion: (() -> Void)?) { let alertWindow = UIWindow(frame: UIScreen.main.bounds) alertWindow.rootViewController = UIViewController() alertWindow.windowLevel = UIWindow.Level.alert + 1; alertWindow.makeKeyAndVisible() alertWindow.rootViewController?.present(self, animated: animated, completion: completion) } } -- Doug _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com