diff --git a/ExponeaSDK/Example/AppDelegate.swift b/ExponeaSDK/Example/AppDelegate.swift index 5109f530..14241a9e 100644 --- a/ExponeaSDK/Example/AppDelegate.swift +++ b/ExponeaSDK/Example/AppDelegate.swift @@ -80,7 +80,7 @@ class AppDelegate: ExponeaAppDelegate { if let type = DeeplinkType(input: url.absoluteString) { DeeplinkManager.manager.setDeeplinkType(type: type) } else { - showAlert("Deeplink received", url.absoluteString) + onMain(self.showAlert("Deeplink received", url.absoluteString)) } return true } @@ -90,27 +90,21 @@ class AppDelegate: ExponeaAppDelegate { extension AppDelegate { func showAlert(_ title: String, _ message: String?) { - DispatchQueue.main.sync { [weak self] in - guard let self else { - Exponea.logger.log(.warning, message: "Alert not shown because of lost frame") - return - } - let alert = UIAlertController(title: title, message: message ?? "no body", preferredStyle: .alert) - alert.addAction( - UIAlertAction( - title: "Ok", - style: .default, - handler: { [weak self] _ in self?.alertWindow?.isHidden = true } - ) + let alert = UIAlertController(title: title, message: message ?? "no body", preferredStyle: .alert) + alert.addAction( + UIAlertAction( + title: "Ok", + style: .default, + handler: { [weak self] _ in self?.alertWindow?.isHidden = true } ) - if alertWindow == nil { - alertWindow = UIWindow(frame: UIScreen.main.bounds) - alertWindow?.rootViewController = UIViewController() - alertWindow?.windowLevel = .alert + 1 - } - alertWindow?.makeKeyAndVisible() - alertWindow?.rootViewController?.present(alert, animated: true, completion: nil) + ) + if alertWindow == nil { + alertWindow = UIWindow(frame: UIScreen.main.bounds) + alertWindow?.rootViewController = UIViewController() + alertWindow?.windowLevel = .alert + 1 } + alertWindow?.makeKeyAndVisible() + alertWindow?.rootViewController?.present(alert, animated: true, completion: nil) } }