Will the following cause a memory leak or could it be changed to be better somehow? With the countDownTimer = nil being removed
-(void)viewDidLoad{
countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(loadNewTime:) userInfo:nil repeats:YES];
}
-(void)pauseTimer{
NSLog(@"Fired");
[countDownTimer invalidate];
//countDownTimer = nil <------ Causes crash when run
}
-(void)resumeTimer{
countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(loadNewTime:) userInfo:nil repeats:YES];
}
NSTimer automatically decrements its retain count when it expires or is invalidated. There is no need to set it equal to nil unless you have assigned it to an ivar that retains. (which in your case means you would have also needed to assign the timer using self.countDownTimer