问题
I'm starting to use iOS5 and I've enabled ARC for my project. I have a class where on deallocation I save the state of that object.
-(void)dealloc {
[self save];
[super dealloc];
}
However, under ARC, [super dealloc] is not allowed? I thought that it was considered a bug if you don't invoke the dealloc method on the super class in this situation?
So what is the appropriate way to dealloc objects now?
回答1:
ARC in iOS 5 is under NDA. That said, judging from publicly available information at the official site of clang, you just don't write [super dealloc]. That's generated automatically by the compiler. See the clause 7.1.2 of the specification.
来源:https://stackoverflow.com/questions/6536832/automatic-reference-counting-arc-says-that-invoking-super-dealloc-is-forbidd