Attempting to load the view of a view controller while it is deallocating ... UIAlertController
I had the same issue with my UIViewController
where i was only declaring variable in my class let alert = UIAlertView()
without using it yet, it was out of all the functions just inside the class as variable. by removing that solves the issue. so please check in your class if you have defined alert from UIAlertView
or UIAlertViewController
like that without using it or in the class variable!
I was finally able to track it down to a UIActionSheet
class variable inside a third-party library, Mapbox GL.
I opened an issue with that dev team: https://github.com/mapbox/mapbox-gl-native/issues/2475
Partial credit (and an up vote and bounty) to @Aaoli for mentioning having a UIAlertView
as a class variable.
We had the same issue with UIAlertController
.
let alert = UIAlertController(title: "", message: "", preferredStyle: UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action : UIAlertAction!) in //some actions } ))
I had forgot adding the following line. Below line solved the problem.
self.presentViewController(alert, animated: true, completion: nil)