Search code examples
xcode5

Why does this code cause the compiler to report "Unused Variable" in Xcode"


NSTimer *valor = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(update) userInfo:nil repeats:YES];


Solution

  • You need to use valor somewhere else. Since it is a timer, you'd probably want to retain it somehow such as setting a property to it:

    self.timer = valor;