我正在尝试学习 iOS5中的自动参考计数。这个问题的第一部分应该很简单:
是否正确,我做 没有需要写明确的 当使用 ARC 时,我的 dealloc 中的 release-property 语句 下面的 没有是否需要一个显式的 Dealloc?
@interface MyClass : NSObject
@property (strong, nonatomic) NSObject* myProperty;
@end
@implementation MyClass
@synthesize myProperty;
@end
My next and more important question comes from a line in the Transitioning to ARC Release Notes document:
You do not have to (indeed cannot) release instance variables, but you may need to invoke [self setDelegate:nil] on system classes and other code that isn’t compiled using ARC.
This begs the question: how do I know which system classes are not compiled with ARC? When should I be creating my own dealloc and explicitly setting strongly retaining properties to nil? Should I assume all NS and UI framework classes used in properties require explicit deallocs?
There is a wealth of information on SO and elsewhere on the practices of releasing a property's backing ivar when using manual reference tracking, but relatively little about this when using ARC.