title: Keep NSTimer running even application goes in background in ios
body: <p>I want to perform particular task in background continuously even my application goes in background.</p>
  
  <p>Here is the code which i tried. Timer is firing only once when it enters in background.</p>
  
  <pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application
      {
        NSTimer * timer = [NSTimer timerWithTimeInterval:2.0
                                      target:self
                                    selector:@selector(timerTicked)
                                    userInfo:nil
                                     repeats:YES];
              [[NSRunLoop mainRunLoop] addTimer:timer
                                        forMode:NSDefaultRunLoopMode];
      }
  
  - (void) timerTicked 
  {
      NSLog(@"Timer method");
  }
  </code></pre>