NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self
selector:@selector(wantsUpdate:) userInfo:nil repeats:NO]

Sometime after it fires (and occasionally before), I call

if ( myTimer )
{
   [myTimer invalidate];
   [myTimer release];
   myTimer = nil;
}


Should I really be doing:

if ( myTimer )
{
    if ([myTimer isValid])
         [myTimer invalidate];

   [myTimer release];
   myTimer = nil;
}



I am doing it the first way without trouble... At least I think it is ok.
The docs say non-repeating timers are invalidated after they fire.

Which way is better?

Comments?




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to