Automatic Reference Counting (ARC) says that invoking [super dealloc] is forbidden…what is the alternative?

狂风中的少年 提交于 2019-12-01 13:41:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!