I'm learning iOS development and I'm trying to view an alert to the user when they launch the app for the first time, then never again. So, I wrote this in my app delegate:
func applicationDidBecomeActive(_ application: UIApplication) {
let alert = UIAlertController(title: "Alert Title", message: "Alert Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Okay", style: .cancel, handler: nil))
self.window?.rootViewController?.present(alert, animated: true, completion: nil)
This code works to view the alert, but the problem I've is that the alert is shown each time the app is launched. So can any one help? It would be extremely appreciated.