In objective-c, I understand that you need to release anything you init/retain/copy. Do I need to do that before a return
statement? I'm wanting to understand calling release
explicitly and not use autorelease
.
-(void) someMethod
{
AnotherClass* ac = [[AnotherClass alloc] init];
if([ac somethingHappens]){
// Do I need to release ac here?
return;
}
[ac doSomethingElse];
[ac release];
}
Thanks!