I want to reset two NSTimers with a new TimeInterval. It would be no problem if I know if they arent released before reseting them.
I can't work like this:
[timer invalidate];
if(startTimers == YES)
timer = [NSTimer scheduledTimerWithTimerInterval:...]
because I don't know if the timer was invalidated before I invalidate it.
And if I invalidate a released timer (on invalidation a timer gets released) I get a EXC_BAD_ACCESS.
When you release the timer, also set its variable to nil. Then [timer invalidate]
will silently do nothing if timer is nil.
[timer invalidate];
timer = nil;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With