开发者

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

开发者 https://www.devze.com 2023-03-16 18:00 出处:网络
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.

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 app开发者_如何学Goropriate way to dealloc objects now?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消