title: NSTimer not stopping
body: <p>I have a Class with a <code>NSTimer *myTimer;</code> variable. At some point I do: </p>
  
  <pre><code>myTimer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(doStuff) userInfo:nil repeats: YES]; 
  </code></pre>
  
  <p>further, I have a method:</p>
  
  <pre><code>- (void)doStuff
  {
    if(myTimer)
    {
      //do stuff
    }
  }
  </code></pre>
  
  <p>and I stop my timer when the class is released through:</p>
  
  <pre><code>- (void)dealloc
  { 
   if (myTimer) { //if myTimer==nil it already has been stopped in the same way
    [myTimer invalidate];
    myTimer = nil;
   }
  }
  </code></pre>
  
  <p>Now, the problem is that when I release the class the timer goes on and on and on firing the event anyway. Am I doing something wrong? It seems the dealloc method is never called, otherwise myTimer would be nil and even if the selector is fired it would not go into  the <code>if(myTimer)</code> </p>