Invalidating a timer

suggest change

Swift

timer.invalidate()

Objective-C

[timer invalidate];

This will stop the timer from firing. Must be called from the thread the timer was created in, see Apple’s notes:

You must send this message from the thread on which the timer was installed. If you send this message from another thread, the input source associated with the timer may not be removed from its run loop, which could prevent the thread from exiting properly.

Notes: Once a timer has been invalidated, it is impossible to fire that same timer again. Create a new timer and schedule it.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents