在实现dealloc时,我在书籍和网络上查看各种代码时都注意到了一点混乱.我的问题是在使用@property时我应该使用以下哪个.到目前为止,我一直在使用VERSION_001.
@property(nonatomic, retain) NSString *name;
@property(nonatomic, retain) NSString *type;
@property(nonatomic, retain) NSString *payload;
@property(nonatomic, retain) NSString *orbit;
Run Code Online (Sandbox Code Playgroud)
版本001
- (void)dealloc {
[name release];
[type release];
[payload release];
[orbit release];
[super dealloc];
}
Run Code Online (Sandbox Code Playgroud)
版本002
- (void)dealloc {
[self setName:nil];
[self setType:nil];
[self setPayload:nil];
[self setOrbit:nil];
[super dealloc];
}
Run Code Online (Sandbox Code Playgroud)