I am given a warning in Xcode that a variable I am using, is not being used:
- (void)timerTicked:(id)sender {
[timerButton setTitle:[self timerIsActive] ? @"Stop timer" : @"Start Timer" forState:UIControlStateNormal];
if([self timerIsActive]) {
NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:timeEntry.startDate];
double seconds = (int) interval % 60;
double minutes = (int) interval / 60.0;
double hours = (int) interval / 60.0 / 60.0;
[timerLabel setText:[NSString stringWithFormat:@"%.0f hours %.0f minutes %.0f seconds", hours, minutes, seconds]];
}
}
The variable reported not being used is interval.
Why is interval being reported as unused?
It works fine for me. Try to clean the code and Analyze using shift commond B. — AV