title: iOS update location even when app is terminated
body: <p>I'm trying to update users location even when app is terminated. I added maps, and background mode --> Location update to my .plist, and I set an local notification that will fire when location is updated. But it never got fired. I have this in <em>AppDelegat.h</em>:</p>
  
  <pre><code>@interface AppDelegate : UIResponder &lt;CLLocationManagerDelegate&gt;{
      CLLocationManager *locationManager;
  }
  </code></pre>
  
  <p>and in <em>AppDelegate.m</em></p>
  
  <pre><code>- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
  
      locationManager = [[CLLocationManager alloc] init];
      locationManager.delegate = self;
      locationManager.distanceFilter = kCLDistanceFilterNone;
      locationManager.desiredAccuracy = kCLLocationAccuracyBest;
      [locationManager requestAlwaysAuthorization];
      [locationManager startMonitoringSignificantLocationChanges];
  }
  </code></pre>
  
  <hr>
  
  <pre><code>    - (void)locationManager:(CLLocationManager *)manager 
      didUpdateLocations:(NSArray *)locations {
  
   UILocalNotification *notification = [[UILocalNotification alloc]init];
  notification.repeatInterval = NSDayCalendarUnit;
  [notification setAlertBody:@"Location update!"];
  [notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]];
  [notification setTimeZone:[NSTimeZone  defaultTimeZone]];
  [[UIApplication sharedApplication] scheduleLocalNotification:notification];
      }
  </code></pre>
  
  <p>I tested this code on simulator with Freeway drive as location and it doesn't work.</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>If I put the code under <code>applicationDidEnterBackground</code> authorization request will close the second it's opened, because I'm using <code>didFinishLaunchingWithOptions</code>. I know it's tracking location 24h because there's GPS symbol even when app is terminated.</p>
  
  <hr>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>After testing it on my phone the code works. It wakes terminated app and sends local notification. It doesn't work on simulator but works in real life(device) :)</p>