下面是否會導致內存泄漏,或者是否可以更改爲更好?隨着countDownTimer = nil
被刪除NSTimer內存泄漏?
-(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];
}