title: swift/ios refreshing app data when in background
body: <p>I'm writing a iOS/Swift application which reads data from a REST service each X minutes and updates the UI accordingly.</p>
  
  <p>Now I would like that when the app is put in the background, a task keeps being invoked at X minutes intervals reading from the REST service and, in case the data just read satisfies a given condition, show a notification prompting the user to bring the app back to the foreground.</p>
  
  <p>In my searches I've read that during <code>applicationDidEnterBackground</code> event, I should start a task with <code>beginBackgroundTaskWithExpirationHandler</code>. </p>
  
  <p>The problem is that, if I've understood correctly, this allows a maximum of 10/15 minutes after which the app is terminated if the task is not stopped with <code>endBackgroundUpdateTask</code>, while I want the task to keep polling the service indefinitely (at least until the user disable it from the app's settings)</p>
  
  <h2>My question is:</h2>
  
  <p>How is this kind of functionality performed normally? Do some common solutions or best practices exist for the solution of such a problem? </p>