I want to display, on screen, the elapsed time since some event. I have a member variable
NSDate *_startTime;
I allocate it (and initiate a timer) like so:
_startTime = [NSDate date];
_timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(clock) userInfo:nil repeats:YES];
My clock function gets called fine but when I attempt to find the elapsed time I get a crash with no real way of determining what happens; I simple get EXC_BAD_ACCESS
. Below is how I attempt to get the elapsed time since _startDate
which throws the exception:
NSTimeInterval secondsElapsed = [_startTime timeIntervalSinceNow];
It crashes on this line - I have looked around and this seems to be the correct syntaax, what is happening here?