How to solve ‘Attempting to present UIAlertController whose view is not in the window hierarchy ‘ in Swift?

We can solve this error by placing alert function call inside viewDidAppear function instead of viewDidLoad function.

Leave a Reply