Which is the best method
Override “release” or “dealloc” method in objective c?
why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Under non-ARC, 99% of the cases you should not override the release method.
I have seen only 1 case that the need to override the release method – a kind of singleton, which forces the class have really 1 single instance no matter how many times you call alloc.
That way override not only the
releasemethod, but alsoallowWithZone:,retain, ‘retainCount`, etc. (It is actually not common to implement that kind of singleton)