Created
July 9, 2011 01:26
-
-
Save TvdW/1073192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In the header file | |
@property (retain) NSObject *obj; | |
// In the code | |
-(id)init { | |
// WRONG: obj = [[NSData alloc] init]; // This won't call [obj retain]; !!!! | |
[self setObj:[[NSData alloc] init]]; // CORRECT: [obj retain]; is called properly | |
return self; | |
} | |
-(void)dealloc { | |
[obj release]; | |
[super dealloc]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment