Swift内存泄漏?

时间:2014-12-17 20:44:24

标签: swift memory-management memory-leaks

当我检查我的应用程序是否有内存泄漏时,我在调用此函数时发现内存泄漏

class func displayAlertWithTitle(title: String, message: String, onView view: UIViewController?) {

        let alertController = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)

        let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
        alertController.addAction(defaultAction)

        if let parentView = view as UIViewController? {
            parentView.presentViewController(alertController, animated: true, completion: nil)
        }

    }

更具体地说是parentView.presentViewController(alertController, animated: true, completion: nil) 任何人都可以解释一下,为什么会发生这种情况?

0 个答案:

没有答案