There is also a very simple trick to detect whether you have the retaining timer problem or not.
I have set a NSTimer and have tried invalidating it but the timer still triggers the selector.
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.
Testing for exact equivalency assumes the timer fires "exactly" when you need it.
Due to hardware or software timer resolutions or other things happening on the system, that may not occur.
I have tweaked the 217 to other numbers and it works. Milliseconds starts at 5000 so it is always going to go past 217.
Code: With timers, always test for greater than or less than.
Now the ivar has the timer instance and you can use it to invalidate the timer.
However, when you use a repeating timer and forget about retaining, this means trouble.
In our project we have a Facebook style wall with posts and status updates.
[_explosion invalidate]; [_explosion release]; //There is a whole 'nother debate on whether or not to retain a scheduled timer //but I am a stickler for ownership so remember to release this in dealloc _explosion = [[NSTimer scheduled Timer With Time Interval:0.1 target:self selector:@selector(explosion) user Info:nil repeats: YES] retain]; ...
If you ARE working on a pre-i OS 6.0 project, for whatever reason, the reason your method isn't being called is at least in part because it is spelled wrong. Your method name should be spelled , which tries to invalidate the timer even fires.