T
T
tupoi2017-08-06 17:16:38
iOS
tupoi, 2017-08-06 17:16:38

How to check if the user has given permission to use geolocation in ios (swift 3)?

Good day, is there any method in CoreLocation that would return a Bool value for the application to access the use of geolocation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Korolevskiy, 2017-08-06
@tupoi

So far, only something like this comes to mind:

if CLLocationManager.locationServicesEnabled() {
     switch(CLLocationManager.authorizationStatus()) {
        case .notDetermined, .restricted, .denied:
            print("No access")
        case .authorizedAlways, .authorizedWhenInUse:
            print("Access")
        }
    } else {
        print("Location services are not enabled")
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question