title: Continue operation when app did enter background on iOS
body: <p>in my app i have some NSOperation that update some core data element from a online database, sometime the update require some minute, and when the screen of iPhone lock, the app enter in the background mode, and this update is stopped, so i have to reopen the app to continue the update, so i have search a lot on stack overflow and i have find some information about:</p>
  
  <pre><code>beginBackgroundTaskWithExpirationHandler
  </code></pre>
  
  <p>that is a method from apple that let continue some task also when the app is in the background mode, and i have do this:</p>
  
  <pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application
  {
  
  UIApplication  *app = [UIApplication sharedApplication];
  UIBackgroundTaskIdentifier bgTask;
  
  bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
      [app endBackgroundTask:bgTask];
  }];
  }
  </code></pre>
  
  <p>and now the app continue the task in the background, and seems that all works fine, so my question is, this method i use is safe? or there is a better mode?</p>
  
  <p>thanks</p>