title: CLLocationManager initialization and call on button
body: <p>I want my app to get current location when user taps a button. I initialize <code>locationManager</code> object in init method. </p>
  
  <p>First question: is this good if I'm going to need currentlocation every time I press button? Or should I initialize it even in <code>viewDidLoad</code>?</p>
  
  <pre><code>- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  
      if (self)
      {
          // Create location manager object
          locationManager = [[CLLocationManager alloc] init];
          locationManager.delegate = self;
  
          // Best accuracy as posibble
          [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
      }
      return self;
  }
  </code></pre>
  
  <p>In my delegate method I <code>stopUpdatingLocation</code> as soon as I got my <code>currentLocation</code>.</p>
  
  <pre><code>// Delegate method
  - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray        
  *)locations   
  {
      CLLocation *currentLocation = [locations lastObject];
  
      [locationManager stopUpdatingLocation];
  }
  </code></pre>
  
  <p>Here I <code>startUpdatingLocation</code> with button:</p>
  
  <pre><code>- (IBAction)getCurrentLocation:(id)sender
  {
      [locationManager startUpdatingLocation];
  }
  </code></pre>
  
  <p>Second question is: when I press button 1st time, I get right location, but when I change location in simulator and press again it shows the 1st one. Again, when I press the button, then it shows the right one. I have tried to initialize <code>locationManager</code> every time button is pressed but it doesn't work that way neither.</p>
  
  <p>I read on other post that its because of location cache or something like that. How do I remove that cache ? Because I'm going to store that location somewhere else in DB anyways so I don't need old one..</p>