title: Run NSTimer in background thread to call method on completion in main thread
body: <p>I have a static method that creates a NSTimer and runs it in the background thread, like so:</p>
  
  <pre><code>+ (void) callInBackgroundThread {
      NSTimer *timer = [NSTimer timerWithTimeInterval:0.2
                                              target:self
                                            selector:@selector(callToMainThread)
                                            userInfo:nil repeats:NO];
      [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
  }
  </code></pre>
  
  <p>and then i call the main thread upon completion like so:</p>
  
  <pre><code>+ (void) callToMainThread{
      NSTimer *timer = [NSTimer timerWithTimeInterval:0
                                               target:self
                                             selector:@selector(foo1)
                                             userInfo:nil repeats:NO];
     [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
  }
  </code></pre>
  
  <p>While this works i feel that this is quite sketchy and I wonder if there is a better way of doing this.
  I would appreciate suggestions, please note that the methods where are static.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Regards</p>