David
David

Reputation: 7456

How to detect system wide Location Services changes

I'm going through potential cases where a User might turn off Location Services on their phone.

Right now, I have:

func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
    if status == .Authorized || status == .AuthorizedWhenInUse {
        manager.startUpdatingLocation()
    } else {
        manager.stopUpdatingLocation()
    }
}

I assume this will trigger whenever the User goes into the Settings and changes my App's settings personally. Does this also trigger whenever the user turns off Location Services for all applications? The documentation doesn't seem to go over it.

Upvotes: 0

Views: 142

Answers (1)

Earl Grey
Earl Grey

Reputation: 7466

Yes. Turning of location services globally will also trigger that method and it effectively means that the kCLAuthorizationStatusDenied will be sent as the current status.

Once the user enables the location services again, the method will be triggered again and one of the other enumerated options will be sent as the current status - And the value will depend on the location services settings history for that specific app.

Upvotes: 1

Related Questions