How to check if Location Services are enabled in iOS App?

Location services as the name suggests gather the user information via GPS, Wifi and cell towers. Every iOS device has on board GPS, WiFi, cell tower location data and Bluetooth to determine the location of the iPhone or iPad. The user can enable or disable location services from the Settings app by toggling the Location Services switch in General.

You should check the return value of locationServiceEnabled() method before starting location updates to determine whether the user has location services enabled for the current device.

To check if Location Services are enabled in iOS app checkout the code

Open Xcode → New Project in ViewController create new function as below and you’re done.

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

Updated on: 30-Jul-2019


Kickstart Your Career

Get certified by completing the course

Get Started