I’m writing an iPhone application that uses GPS data. My problem is that the GPS never stops updating the locations (the arrow stays on the status bar) even if I kill the actual process. The only way to make it disappear is uninstalling the app, or disallowing it to use location in system settings.
This is how I create the location manager:
// Create the location manager if this object does not
// already have one.
if (nil == locationManager)
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = regionTracker;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
// Set a movement threshold for new events.
locationManager.distanceFilter = 1;
[locationManager startUpdatingLocation];
In my app delegate, I run these two rows both in applicationWillTerminate: and applicationDidEnterBackground:
[self.viewController.locationManager stopUpdatingLocation];
[self.viewController.locationManager setDelegate:nil];
I nil the delegate because I saw some example where they did that, but should it really be needed?
Same as milonet mentioned, in my case I needed to call stopMonitoringSignificantLocationChanges in addition to the stopUpdatingLocation.