Possible Duplicate:
Incorrect decrement of the reference count of an object that is not owned at this point by the caller
Why shouldn't I use the getter to release a property in objective-c?
So, I get that using [self.myProperty release]
is discouraged (Apple itself recommends not to). Although it appears to me that it COULD lead to problems in some cases, not all cases. Is this correct? More importantly: I don't get why using a syntax like [self.myProperty release]
in my -dealloc
method(s) will cause the static analyzer to show an "incorrect decrement"
error. Despite any other reason discouraging such a syntax, my class still owns its properties (which I have declared with "nonatomic,retain"
) so why the warning?
I've been reading several posts on this but it seems I can't really wrap my mind around it. Some of them go into details about the possible side effects of using such a syntax, but what I really want to know is the reason behind the "incorrect decrement" error.
Any help would greatly be appreciated.