Today I got bitten by a bad iOS bug.
With ARC enabled and also Zombie Objects enabled, dealloc of a View might never be called!
For details see:
Also very interesting:
at least the original post. The answers are rather confusing though …
So my incarnation of the bug goes as follows….
On my core data based app, if a user logs in, I cleanly open the user’s persistent store.
If the user logs out again, I’ll do the logging out in the background. This keeps the persistent store referenced until the logging out is done.
Now, if the same user logs in again I’ll wait with a spinner until the persistent store is released before I open the store again with a new persistent store coordinator.
Now most of the app is non-ARC. Just one component (GMGridView) is ARC enabled.
When I compile the app with zombies objects enabled, on logout the (flawless) GMGridView component is correctly released and deallocated but ARC does not decrement the retain count of the (non-ARC) GMGridViewCells to 0. The cells dealloc is never called, it does not release it’s reference to the store and the next login will wait forever.
Disabling zombie object fixes the problem!
Googling for this issue suggests that this is fixed in iOS 6.
Took me three evenings to find out that this was related to zombie objects