iPhone Programming - NSTimer Gotcha's

This forum is intended to enable people developing products using the PISD Libraries to recieve easy technical support and also to ask general questions about the libraries to other people using them.
Post Reply
User avatar
PISD Support
Moderator
Posts: 26
Joined: Thu 21 May, 2009 4:19 pm

iPhone Programming - NSTimer Gotcha's

Post by PISD Support » Sun 27 Dec, 2009 10:53 pm

A few warnings about using NSTimer's within iPhone programs.

The first thing which isn't apparently obvious is that while you are allowed to call code which appears to change the frequency of a timers callback (ie. to make it faster or slower) this code will have NO effect within the program.

The second thing to consider is that you have to ensure you 'invalidate' a timer to stop it from triggering, simply setting it to 'nil' is not enough.

Code: Select all

	[self._timer invalidate];
	self._timer = nil;

Post Reply