【问题标题】:Does dealloc still get called?dealloc 还会被调用吗?
【发布时间】:2014-10-02 10:05:56
【问题描述】:

对于我的 iOS 7 应用,只想确认一下:

  1. dealloc 还会被调用吗?
  2. 和ARC是否开启有关系吗?

【问题讨论】:

  • 是的,您实际上可以通过在您的自定义 dealloc 实现中记录一些内容来确认这一点。

标签: ios ios7 ios8 automatic-ref-counting dealloc


【解决方案1】:

是的,dealloc 在对象被释放时调用,无论您是否使用 ARC。

但是请注意,当您使用 ARC 时,您不需要(事实上您不能)从您的 dealloc 实现中调用 [super dealloc],因为 ARC 会自动执行此操作。

【讨论】:

    猜你喜欢
    • 2012-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-06
    • 2011-12-17
    • 1970-01-01
    相关资源
    最近更新 更多