title: Location tracking stops after a while when app is in the background
body: <p>I've created a simple app which tracks user location and creates local notification for every time location is updated.</p>
  
  <p>I enabled the background modes below,</p>
  
  <p><a href="https://i.stack.imgur.com/1S0nj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1S0nj.png" alt="enter image description here"></a></p>
  
  <pre><code>let locationManager = CLLocationManager()
  
  open override func viewDidLoad() {
         locationManager.delegate = self;
         locationManager.desiredAccuracy = kCLLocationAccuracyBest;
         locationManager.distanceFilter = 10
         locationManager.allowsBackgroundLocationUpdates = true
         locationManager.startUpdatingLocation()
  }
  
  open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
         let notification = UILocalNotification()
         notification.alertBody = "location updated"
         notification.fireDate = Date()
         UIApplication.shared.scheduleLocalNotification(notification)
  }
  </code></pre>
  
  <p>I set string for <code>NSLocationAlwaysUsageDescription</code> and ask for permission. User grant permission for always usage when the app loaded first time. </p>
  
  <hr>
  
  <p>It's working well when app is in the foreground, when it goes background <strong>still working</strong> at least in 5-40 minutes time range which is changeable
  by battery or other opened apps.</p>
  
  <p>The problem is why it stops working, Isn't it expected to be keep working?</p>
  
  <p>I've never seen a time limit in Apple docs. </p>