title: NSTimer doesn't work in background
body: <p>I have an issue that my NSTimer doesn't work when the app is working in backgroud.
  on the simulator it is work, on the device it is not.</p>
  
  <p>my code on the AppDelegate.m:</p>
  
  <pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application
  {
      NSLog(@"enter background");
  
      notiTimer = [NSTimer scheduledTimerWithTimeInterval:4 target:self selector:@selector(checkNotification) userInfo:nil repeats:YES];
      [[NSRunLoop mainRunLoop] addTimer:notiTimer forMode:NSDefaultRunLoopMode];
  }
  </code></pre>
  
  <p>and the method I am trying to run in loop:</p>
  
  <pre><code> -(void)checkNotification {
  
      NSLog(@"running loop in bg");
  
      userdetails =[NSUserDefaults standardUserDefaults];
      userid = [userdetails objectForKey:@"userid"];
      username = [userdetails objectForKey:@"username"];
      if (userid != NULL &amp;&amp; username != NULL) {
  
          notifString = [NSString stringWithFormat:@"userid=%@", userid];
          notifData = [NSData dataWithBytes: [notifString UTF8String] length: [notifString length]];
          urlreq = [[NSMutableURLRequest alloc] initWithURL:notifUrl];
          [urlreq setHTTPMethod: @"POST"];
          [urlreq setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
          [urlreq setHTTPBody: notifData];
          sendreq = [NSURLConnection sendSynchronousRequest:urlreq returningResponse:nil error:nil];
          response =[[NSString alloc] initWithBytes:[sendreq bytes] length:[sendreq length] encoding:NSUTF8StringEncoding];
          responsTrimmed = [response stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
          splitResponse = [responsTrimmed componentsSeparatedByString: @","];
          if ([splitResponse[0] isEqualToString:@"1"]) {
              NSLog(@"%@",splitResponse[1]);
          }
          else {
              NSLog(@"err");
          }
      }
  
  }
  </code></pre>
  
  <p>now once at the app enter to background I get at the debugger the NSLog: </p>
  
  <pre><code>  NSLog(@"enter background");
  </code></pre>
  
  <p>but the run loop doesn't work and the method doesn't call in loop and I don't get NSLog </p>
  
  <pre><code>NSLog(@"running loop in bg");
  </code></pre>
  
  <p>on the debugger, any idea ?</p>