Attempting to load the view of a view controller while it is deallocating … UIAlertController

后端 未结 7 1987
走了就别回头了
走了就别回头了 2020-12-24 01:55

I am building with the release version of Xcode 7.0. No storyboards, just nib files.

I have a single UINavigationController created by the app delegate

7条回答
  •  春和景丽
    2020-12-24 02:03

    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)
    

提交回复
热议问题