我想了解xcode调试工具如何在检测保留周期方面工作。 我有一个简单的父和子视图控制器都拥有彼此的引用。 并且在几次执行应用程序打开关闭VC之后,当我打开调试工具时,它既不显示保留周期也不存在运行时问题。 请从下面的代码示例和连接的Xcode调试工具的截图xcode保留周期不显示在内存图
class ViewController: UIViewController {
var child: ChildViewController?
@IBAction func open(_ sender: Any) {
performSegue(withIdentifier: "segueChild", sender: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "segueChild") {
child = segue.destination as? ChildViewController
child?.parentVC = self
}
}
}
class ChildViewController: UIViewController {
var parentVC: ViewController?
@IBAction func close(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
您是否找到了答案?我刚刚问了一个类似问题。哈哈https://stackoverflow.com/questions/48988810/xcode-memory-graph-debugger-not-showing-cycles – Fogmeister
@Fogmeister否:),但它是伟大的它不仅是我:D – mihatel