title: Instantiating Singleton class with CLLocationManager in AppDelegate didFinishLaunchingWithOptions
body: <p>i am using a singleton class to track a users location. if i instantiate the class from within my running app and start tracking everything is peachy.</p>
  
  <p>however, if the app is closed (in the app switcher so it isn't backgrounded any more) and restarted i check if there is an active event. in this case i instantiate the class and start the location tracking. the <code>locationManager</code> gets instantiated and the location arrow appears in the statusbar, but the </p>
  
  <pre><code>    -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations 
  or 
      -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
  never get called
  </code></pre>
  
  <p>any idea?</p>
  
  <p>code singelton class:</p>
  
  <pre><code>@interface AlarmMeTrackUserLocation () &lt;CLLocationManagerDelegate&gt;
  @property (strong, nonatomic) CLLocationManager *locationManager;
  @end
  
  @implementation AlarmMeTrackUserLocation    
  -(void)toggleLocationUpdates:(bool)toggle {
  
      if (!toggle) {
          [self.locationManager stopUpdatingLocation];
          self.locationManager = nil;
          sharedInstance = nil;
          NSLog(@"--- UserTrack Stopped ---");
          return;
      }
  
  
      if (!self.locationManager &amp;&amp; toggle) {
          self.locationManager = [[CLLocationManager alloc] init];
          self.locationManager.delegate = self;
          self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
          self.locationManager.pausesLocationUpdatesAutomatically = YES;
          self.locationManager.distanceFilter = 200;
      }
  
      NSLog(@"--- UserTrack Started");
      [self.locationManager startUpdatingLocation];
  
  }
  
  -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
      ...
  }
  
  - (void)locationManager:(CLLocationManager *)manager
     didFailWithError:(NSError *)error {
      ...
  }
  
  + (AlarmMeTrackUserLocation *)sharedTrackUserLocation {
  
      if (sharedInstance == nil) {
          sharedInstance = [[super allocWithZone:NULL] init];
  
          //NSLog(@"--- New Instance created ---");
  
          return sharedInstance;
      }
  
      NSLog(@"--- Existing Instance Used ---");
  
      return sharedInstance;
  }
  </code></pre>
  
  <p>code from AppDelegate:</p>
  
  <pre><code>@property (strong, nonatomic) AlarmMeTrackUserLocation *userTrack;
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      ...
      self.userTrack = [AlarmMeTrackUserLocation sharedTrackUserLocation];
      self.userTrack.event = currentEvent;
      [self.userTrack toggleLocationUpdates:YES];
  
  }
  </code></pre>