title: How to check if NSTimer has been already invalidated
body: <p>I have a <code>NSTimer</code> object that I need to invalidate if a user taps on a button or if they exit a view.</p>
  
  <p>So I have:</p>
  
  <pre><code>[myNSTimer invalidate];
  </code></pre>
  
  <p>inside my button handler and inside <code>viewWillDisappear</code>. If user taps on a button and then exists a view the app throws an exception because <code>myNSTimer</code> has already been invalidated.
  What I need to do in the <code>viewWillDisappear</code> method is check if the <code>myNSTimer</code> has been invalidated or not. How do I do that?</p>
  
  <p>I've tried:</p>
  
  <pre><code>if(myNSTimer != nil)
    [myNSTimer invalidate];
  </code></pre>
  
  <p>but that didn't work.</p>