title: iOS: EXC_BAD_ACCESS caused by running timer in NSThread?
body: <p>I have been having some crashes in my app.  When checking the logs and using atos, it is telling me exactly where I get the crash, which is where I tell my NSRunLoop to run:</p>
  
  <pre><code>/**
   * Create a new thread for the timer
   *
   * @version $Revision: 0.1
   */
  - (void)createTimerThread {
      NSThread *timerThread = [[NSThread alloc] initWithTarget:self selector:@selector(startTimerThread) object:nil];
      [timerThread start];
      [timerThread release];
  }//end
  
  
  /**
   * Start the actual timer
   *
   * @version $Revision: 0.1
   */
  - (void)startTimerThread {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
  
      // Start timer
      self.countTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateCounter:) userInfo:nil repeats:YES];
  
      [runLoop run];// &lt;--- Crash happened here
      [pool release];
  
  }//end
  
  
  /**
   * Update the counter
   *
   * @version $Revision: 0.1
   */
  - (void)updateCounter:(NSTimer *)theTimer {
  
      // Does tons of timer stuff here
  
  }//end
  </code></pre>
  
  <p>As you can see, the crash happens on <code>[runLoop run]</code> but I have no idea why. It normally happens the second time that I call the createTimerThread method.  </p>
  
  <p>What am I doing wrong here?  All I was wanting to do was run a timer in the background so that it wasn't on the main thread because I needed to update a <code>UILabel</code>.</p>
  
  <p>Should I be using something new like Grand Central Dispatch (GCD)?</p>