Dealloc not being called on ARC app

前端 未结 7 1229
盖世英雄少女心
盖世英雄少女心 2020-12-12 18:21

I have a UIViewController that is pushed onto a container controller and then popped off, and using the allocations instrument, I can see that the view controller is destroy

7条回答
  •  旧时难觅i
    2020-12-12 18:52

    If dealloc is not being called by the VC, then I would bet there is a circular reference somewhere in your code, which is preventing ARC from calling dealloc.

    Some things to check:

    1. Do you have an object instantiated that references back to the VC?
    2. If you need to reference the VC be sure you have used '__unsafe_unretained' attribute or 'weak' (iOS5+) so that the retain cycle does not occur.

    I was nipped in the butt when my delegate declarations did not utilize __unsafe_unretained.

提交回复
热议问题