views:

37

answers:

1

This is how my code looks currently

NSTimer *delayTimer;
delayTimer = [NSTimer scheduledTimerWithTimeInterval:0.01
                                              target:self
                                            selector:@selector(longRunner)
                                            userInfo:nil
                                             repeats:NO];

// [delayTimer invalidate];

If I run this through build and analyze I get the following warning

Value stored in delayTimer is never read.

I understand the message and what it means but can't really figure out how to stop it appearing. Are there some analyzer messages ok to ignore?

I tried adding the commented invalidate code, but as expected this ran before the timer so the timer didn't.

+1  A: 

I think it's safe, it only warns you that your value not got readed in your script.

Like php warns you with:

Notice: Undefined variable:

Still you should probably invalidate your timer somewhere in your code unless it has to run until you quit the application.

Jordy
What I am attempting to do is control the flow in an iPhone application to display an activity view. The delaytimer is the last line in the method. does this mean I need a new property for the timer so I can reference it from longrunner, or is there a better way
jimsis

related questions