From f4e7d782d902934984b1c298eac6e7dccc8f0f07 Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Wed, 5 Aug 2026 13:12:45 +0100 Subject: [PATCH] fix(ios): Correct error when location services are off --- ios/Sources/GeolocationPlugin/GeolocationPlugin.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ios/Sources/GeolocationPlugin/GeolocationPlugin.swift b/ios/Sources/GeolocationPlugin/GeolocationPlugin.swift index c9252d5..d63c244 100644 --- a/ios/Sources/GeolocationPlugin/GeolocationPlugin.swift +++ b/ios/Sources/GeolocationPlugin/GeolocationPlugin.swift @@ -130,7 +130,8 @@ private extension GeolocationPlugin { switch status { case .denied: - self.onLocationPermissionNotGranted(error: .permissionDenied) + let error: GeolocationError = self.locationService?.areLocationServicesEnabled() == false ? .locationServicesDisabled : .permissionDenied + self.onLocationPermissionNotGranted(error: error) case .notDetermined: self.requestLocationAuthorisation(type: .whenInUse) case .restricted: @@ -233,7 +234,12 @@ private extension GeolocationPlugin { switch locationService?.authorisationStatus { case .authorisedAlways, .authorisedWhenInUse: onLocationPermissionGranted() - case .denied: callbackManager?.sendError(.permissionDenied) + case .denied: + if locationService?.areLocationServicesEnabled() == false { + callbackManager?.sendError(.locationServicesDisabled) + } else { + callbackManager?.sendError(.permissionDenied) + } case .restricted: callbackManager?.sendError(.permissionRestricted) default: break }