I'm instantiating and scheduling a timer variable but Xcode compiler and analyzer marks my var "levelScoreTimer" with 2 warnings like "warning: unused variable 'levelScoreTimer' and "Dead store: Value stored to 'levelScoreTimer' during its initialization is never read". What is wrong with my declaration? The scheduledTimerWithTimeInterval method instantiates and puts the timer on the main run loop. I'm also stopping the timer from selector method inside, so the timer as objects is used for sure. Sometimes in similar cases I break the line into two lines by declaring a type for variable on the first line and making assignment on the second line. But it is not a solution for timer object. Any suggestions? Here is my declaration and assigment:
NSTimer *levelScoreTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateTotalScoreLabelFromTimeLeftLabel:) userInfo:nil repeats: YES];
Change the code from
NSTimer *levelScoreTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateTotalScoreLabelFromTimeLeftLabel:) userInfo:nil repeats: YES];
to
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateTotalScoreLabelFromTimeLeftLabel:) userInfo:nil repeats: YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With