1
我得到上述錯誤的視圖控制器,雖然我有完全相同的代碼在另一個視圖控制器,其中我沒有收到錯誤:嘗試加載視圖控制器的視圖,而它正在釋放...(<UIAlertController:>)
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: .Alert)
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
alertController.addAction(UIAlertAction(title: "Settings", style: UIAlertActionStyle.Default, handler: {
action in
UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)
}
))
if self.presentedViewController == nil{
self.presentViewController(alertController, animated: true, completion: nil)
}
}