Harikarthick K Harikarthick K - 1 month ago 6
iOS Question

How to display UIAlertView after some time?

I'm trying to display a UIAlertView after some time (like 5 minutes after doing something in the app). I'm already notifying the user if the app is closed or in a background. But I want to display a UIAlertView while the app is running. I don't want to refresh again and again. After three minutes I have to show some alert like do you want to save or not?

Answer

Use

self.perform(#selector(displayAlert), with: nil, afterDelay: 300)

where display alert is the function in which you display the alert.