I have a piece of code, for example:
m_timer = [NSTimer scheduledTimerWithTimeInterval:timeOutInSeconds target:self selector:@selector(activityIndicatorTimer:) userInfo:nil repeats:NO];
When I call it like this, the selector does not start after the specified OutInSeconds time. However, if I change it as shown below, the selector is called twice.
NSLog(@"Timer set"); m_timer = [NSTimer scheduledTimerWithTimeInterval:timeOutInSeconds target:self selector:@selector(activityIndicatorTimer:) userInfo:nil repeats:NO]; [[NSRunLoop currentRunLoop] addTimer:m_timer forMode:NSRunLoopCommonModes];
Can anyone suggest any suggestions that I'm probably wrong?
I use Xcode 5.1 and build on 7.1.1 iPhone 4S
ios nstimer
xceph
source share