自动引用计数(ARC)表示禁止调用[super dealloc] ...有什么替代方案?

Tim*_*ddy 26 objective-c ios5 automatic-ref-counting

我开始使用iOS5,我已经为我的项目启用了ARC.我有一个类在deallocation我保存该对象的状态.

-(void)dealloc {
    [self save];
    [super dealloc];
}
Run Code Online (Sandbox Code Playgroud)

但是,在ARC下,[super dealloc]是不允许的?如果在这种情况下你没有在超类上调用dealloc方法,我认为它被认为是一个错误?

那么现在解除对象的适当方法是什么?

Yuj*_*uji 39

iOS 5中的ARC属于NDA.也就是说,根据clang官方网站上的公开信息判断,你只是不写[super dealloc].这是由编译器自动生成的.见规范第7.1.2节.