Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(iphone) do I need to invalidate timer when repeats: no?

[NSTimer scheduledTimerWithTimeInterval: target: selector: userInfo: repeats:NO];

When repeats: is set to NO, do I need to invalidate the timer inside the specified selector?

Thank you

Edit

Another question, if it self invalidates,

How do you properly cancel a such timer?
Since invalidating already-invalidated timer would crash I assume?

maintain a pointer to the timer and set it to nil inside the selector that will get fired?

like image 993
eugene Avatar asked Jan 20 '23 07:01

eugene


1 Answers

No, the timer will invalidate itself

like image 94
Kai Avatar answered Jan 29 '23 12:01

Kai