That's an easy one. -Easy for me, because I had much trouble with it
earlier. =)
Remember to retain your timer:
- (void)timerStop
{
if(timer)
{
[timer invalidate];
[timer release];
timer = NULL;
}
}
-
On Dec 14, 2008, at 11:52 AM, Jens Bauer wrote:
because the timer is autoreleased.
This is not the case -- see http://developer.apple.com/documentation/Cocoa/Conceptual/Timers/Articles/usingTimers.html
(Memory Management).
mmalc
___
Cocoa-dev
On Sun, Dec 14, 2008 at 2:52 PM, Jens Bauer jensba...@christian.net wrote:
You probably experience your crash, because the timer is autoreleased. If
you retain it, it'll live. However, you'll have to remember the timer
object, so you can stop it later, so add NSTimer *timer; as a member
Take a look at the stack trace again. It's happening within the call
to +[NSTimer scheduledTimerWithInterval:target:selector:userInfo:repeats:].
The problem can't be that he hasn't retained a timer he hasn't
created yet.
The problem is that he's corrupted the heap, which could have happened
Hello,
I have a NSTimer that is created every time I press a button. It then
calls the update function successively until some amount of time passes.
When I press the button again I get a EXC_BAD_ACCESS on the timer's
initialization :
NSTimer *timer = [NSTimer