I'm relatively new to iOS development so please excuse me if this is a retarded question. I've read this but am still a bit confused.
I'm not using ARC. (Yes yes, I know I should but I don't at this point) In my class header I have this
/*-----------------------------------------------------------------------+
| The name of the sender/receiver
+-----------------------------------------------------------------------*/
@property (nonatomic, retain) NSString *name;
I do NOT synthesize this variable but let the compiler do that job.
What of the following is considered to be best practise for the dealloc
method
#1 Dealloc the iVar
-(void) dealloc {
[_name release];
[super dealloc];
}
#2 Dealloc the property
-(void) dealloc {
[self.name release];
[super dealloc];
}
#3 And a last question. Is is customary to set the property
to nil
in the dealloc
method? I.e.
-(void) dealloc {
[self.name release];
self.name = nil;
[super dealloc];
}
Would really appreciate if someone could explain this to me.
Regards!