title: How to run NSTimer in background beyond 180sec in iOS 7?
body: <p>I have tried this but not working more than 180 sec in iOS 7 and Xcode 4.6.2. Please help me </p>
  
  <pre><code>    UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid;
          UIApplication *app = [UIApplication sharedApplication];
         bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
              [app endBackgroundTask:bgTask];
          }];
          NSTimer  *timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self   selector:@selector(timerMethod) userInfo:nil repeats:YES];
          [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
       -(void) timerMethod{
  
       NSLog(@"in timerMethod");
      }
  </code></pre>