Created
June 14, 2012 19:42
-
-
Save echoz/2932465 to your computer and use it in GitHub Desktop.
Nothing wrong with messaging nil
This file contains hidden or 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
// Consider an accessor setter method | |
-(void)setUniqueIDString:(NSString *)uid { | |
if (uid != _uid) { | |
[_uid release]; | |
_uid = [uid copy]; | |
} | |
} | |
// You can do [object setUniqueIDString:nil] and not crash. | |
// It also semantically makes sense whether _uid is nil or has an object assigned. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment