Yes, there are other questions out there about this but I cannot find my answer, so I'm asking it too. Here is my code:
#pragma mark - Timer methods
- (void)counter
{
self.seconds++;
double time = self.seconds;
NSLog(@"seconds = %f", time);
}
- (void)startTimer
{
self.seconds = 0;
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(counter)
userInfo:nil
repeats:YES];
}
- (void)stopTimer:(CaptureTimeType)timerType
{
[self.timer invalidate];
self.timer = nil;
}
I went through a tutorial and this code works in a project all it's own. But when I add it to my "real" project, the selector (counter) never gets executed. Does anybody have a clue why this code would work in one project and not in another? Because I'm baffled.
Thank you, Lucy
OK. Here is the code that calls it. It is in the same class and, as far as I know, it is in the same thread:
- (void)generateImage:(cv::Mat)src
{
[self startTimer];
ph::ImageProcessor newImage = *([self.processor generateImage:src]);
[self stopTimer:TEMPLATE];
}
Does this help?
Thanks again.