Hi All
I am trying to dealloc a ViewController in ARC mode. However, the RefCount is always non-zero.
I have tried to set all object to nil and all subviews to removeFromSuperview + nil; and timer to invalidate + nil; still the counter = 2;
Is there a way to trace which pointer is still in retain?
Thanks
If you are using blocks you might also create retain cycle there. E.g. a block is referenced by an object and inside this block you are referencing object or calling instance method for object. Another option for retain count not dropping to 0 is that you have registered abject as observer for notification.
You might find this answer helpful: https://stackoverflow.com/a/12286739/2261423
Example of strong reference cycle from apple docs:
self.block = ^{
[self doSomething]; // capturing a strong reference to self
// creates a strong reference cycle
};