This is my exact code, and it doesn’t seem to be working. Can you tell me what I am doing wrong? Note that refreshTimer was already declared in the private interface.
-(void)viewDidLoad {
refreshTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerTest) userInfo:nil repeats:YES];
}
-(void)timerTest {
NSLog(@"Timer Worked");
}
Give
scheduledTimerWithTimeIntervala try:Quoting: NSTimer timerWithTimeInterval: not working
scheduledTimerWithTimeInterval:invocation:repeats: andscheduledTimerWithTimeInterval:target:selector:userInfo:repeats: create timers that get automatically added to anNSRunLoop, meaning that you don’t have to add them yourself. Having them added to anNSRunLoopis what causes them to fire.