Nstimer not invalidating

Now keeping track of the timer is not required if you only invalidate it after it fires.You could just take an extra parameter on the explosion method that would be the timer ...As this is a very interactive part of an app it should be refreshed quite often.You can probably recall quite easily one of your cases. You create a local variable named explosion that has the same name as the instance variable.Avoid declaring instance variables and local variables with the same name! The you can invalidate "the Timer" and be sure you're invalidating the right one.Testing for exact equivalency assumes the timer fires "exactly" when you need it.

I have a UIDate Picker to select the date to countdown to, but ever every time I try to do a countdown the seconds start at 54 seconds instead of adjusting to the actual time of the device.

The code is very simple and straightforward, but I am struggling to figure it out.

I have 4 NSTimers in my app , that make requests to a rest url every few seconds.

Also, note that your timer's method is incorrect; it must take one parameter which is a pointer to the timer.

You can also use this pointer to invalidate the timer when it fires. As a word of advice you should use a naming convention for instance variables such as an underscore prefix.

Leave a Reply