title: CLLocationManager startUpdatingLocation not calling locationManager:didUpdateLocations: or locationManager:didFailWithError:
body: <p>I'm trying to use the <code>CLLocationManager</code> framework in my iOS project to access the user's location but when I call </p>
  
  <pre><code>[locationManager startUpdatingLocation]
  </code></pre>
  
  <p>neither <code>locationManager:didUpdateLocations:</code> or <code>locationManager:didFailWithError:</code> are getting called.</p>
  
  <pre><code>//myViewController.h
  @interface myViewController : UITableViewController &lt;CLLocationManagerDelegate&gt;
  @end
  
  //myViewController.m
  @implementation myViewController{
      CLLocationManager *locationManager;
  }
  
  //edit
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  locationManager = [[CLLocationManager alloc] init];
  }
  //finish edit
  
  -(void)getLocation
  {
      locationManager.delegate = self;
      locationManager.desiredAccuracy = kCLLocationAccuracyBest;
      [locationManager startUpdatingLocation];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
  {
  UIAlertView *errorAlert = [[UIAlertView alloc]
                             initWithTitle:@"Error" 
                                   message:@"Failed to Get Your Location"              
                                  delegate:nil 
                         cancelButtonTitle:@"OK" 
                        otherButtonTitles:nil];
  [errorAlert show];
  }
  
  - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
  {
      CLLocation *newLocation = locations[[locations count] -1];
      CLLocation *currentLocation = newLocation;
      NSString *longitude = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.longitude];
      NSString *latitude = [NSString stringWithFormat:@"%.8f", currentLocation.coordinate.latitude];
  
  if (currentLocation != nil) {
     NSLog(@"latitude: %@", latitude);
     NSLog(@"longitude: @"%@", longitude);
  }else {
      UIAlertView *errorAlert = [[UIAlertView alloc]
                                 initWithTitle:@"Error" message:@"Failed to Get Your Location" 
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles:nil];
      [errorAlert show];
  }
  
  }
  @end
  </code></pre>
  
  <p>Neither delegate method is being called despite what it says in the documentation: </p>
  
  <p>"This method returns immediately. Calling this method causes the location manager to obtain an initial location fix (which may take several seconds) and notify your delegate by calling its <code>locationManager:didUpdateLocations:</code> method [...] In addition to your delegate object implementing the <code>locationManager:didUpdateLocations:</code> method, it should also implement the <code>locationManager:didFailWithError:</code> method to respond to potential errors."</p>
  
  <p>Don't know how to debug the issue.</p>
  
  <p>Thanks,</p>
  
  <p>JA</p>