4thSpace
4thSpace

Reputation: 44312

How to turn off location services?

If a user has location services on, I assign my RootController as its delegate:

appDelegate.clLocationManager.delegate = self;

where appDelegate is an instance of my application delegate, which is where I have the location services instance. clLocationManager is an instance of CLLocationManager. If I discover the user is outside of a certain region, I want to disable location service delegates. I do this:

appDelegate.clLocationManager.delegate = nil;

But this method still fires:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

Is there another way to disable location services or at least keep its methods from firing?

Upvotes: 3

Views: 8482

Answers (1)

Jakob Borg
Jakob Borg

Reputation: 24415

Yes, you need to tell it to stop updating location:

[appDelegate.clLocationManager stopUpdatingLocation];

After that you can also release it.

See the documentation for details.

Upvotes: 2

Related Questions