iphone - Is this NSTimer dealloc acceptable or will it produce an unexpected error? -


i duplicating code, refactored this:

-(void) dealloc {     [self resettimer];     [super dealloc]; }  -(void) resettimer {     if( timer != nil ) {         [timer invalidate];     }     timer = nil;     // set other value zero... } 

is acceptable call resettimer method in dealloc method? otherwise end writing same 4 lines in resettimer twice.

i did same thing, , worked fine me. (although rely on nil call, it's just:)

-(void) resettimer {    [timer invalidate];     timer = nil; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -