Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTimer Xcode Warning

I have an NSTimer that I initialize with scheduledTimerWithTimeInterval: with a very short interval (.1 seconds) with no repeat, and then never use it again as it invalidates itself and therefore releases its retain on the target. Xcode warns that it is an unused variable, and I was curious if there was a sensible way to get rid of the warning (The yellow upsets my eyeballs!)

Thanks.

like image 345
Jesse Naugher Avatar asked May 27 '11 15:05

Jesse Naugher


1 Answers

if you don't use it again don't save it in a variable.

[NSTimer scheduledTimerWithTimeInterval:0.4 target:self selector:@selector(timer:) userInfo:nil repeats:NO];

will work perfectly fine

like image 135
Matthias Bauch Avatar answered Oct 05 '22 14:10

Matthias Bauch