Mika
Mika

Reputation: 5835

My app doesn't release location services

One of my apps does not release location services even when it's killed by the user.

Symptoms: the location services icon appears on the phone at all times.

It has something to do with the "background app refresh" setting on the phone but as far as I know I do not use any background services.

I use location services in two places in the app (should I be deallocating?):

Place 1:

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startMonitoringSignificantLocationChanges];

Place 2: I have an MKMapView in one view controller.

Upvotes: 0

Views: 53

Answers (1)

InsertWittyName
InsertWittyName

Reputation: 3940

You've started the monitoring using startMonitoringSignificantLocationChanges, you'll also need to stop it using stopMonitoringSignificantLocationChanges.

I normally do this by listening for the UIApplicationDidEnterBackgroundNotification and UIApplicationWillTerminateNotification and then calling stopMonitoringSignificantLocationChanges.

Upvotes: 1

Related Questions