iphone - How do I know when to release an NSDate object? -
Both of these date points require a [release] when I am done with them. How do I know this? I'm unsure because I'm not init clearly.
NSDate * date = [NSDate date]; NSDT * Date = [DateTimeTeamServiceSignon1970: 100000000]; Both are autoreleased, this is the reason why you do not have to release them yourself. The rule of thumb is that if you retain it by ALLOCK or -cp or explicitly, then you are the owner of an object: - [[SomeClass alloc] init ...] < / Li>
- [some object copy]
- [preserves some objects]
If you are the owner of the object, then you have to release it + There is a shortcut to the new + alloc and -init.
Comments
Post a Comment