title: Stopping CLLocationManager?
body: <p>I would like to ask for advice on stopping a CLLocationManager -startUpdatingLocation. Currently I am considering two methods, but I am unsure which to use and would like to get an idea how other folks do this:</p>
  
  <p><strong>Method_001:</strong></p>
  
  <pre><code>[locationManager startUpdatingLocation];
  [self performSelector:@selector(stopUpdatingLocation:) withObject:@"TimedOut" afterDelay:30];
  </code></pre>
  
  <ul>
  <li>Potentially wastes battery life as always runs for 30secs</li>
  <li>If network is slow might not get an accurate location in time</li>
  <li>Feels quite a tidy way to implement the timeout.</li>
  </ul>
  
  <p><strong>Method_002:</strong></p>
  
  <pre><code>[locationManager startUpdatingLocation];
  </code></pre>
  
  <p>Then inside: <code>-locationManager:didUpdateToLocation:fromLocation:</code> add:</p>
  
  <pre><code>static int timeOut = 0;
  timeOut++;
  
  // Other code that checks for and stops
  // when a suitable result, accuracy, age etc is found.
  
  if(timeOut &gt;= 4) {
      [[self locationManager] stopUpdatingLocation];
      timeOut = 0;
      return;
  }
  </code></pre>
  
  <ul>
  <li>Might not resolve an accurate location in 4 (or less) attempts.</li>
  <li>4 results might not be returned for CLLocationManager and we never timeout.</li>
  <li>Better on battery life as we stop immediately on a good result.</li>
  </ul>
  
  <p>Just curious?</p>