I’m using Xamarin.Essentials for location services, but I’m encountering an exception on iOS 18 when trying to get the current location. The error message states:
Foundation.NSErrorException: Error Domain=kCLErrorDomain Code=2 “(null)”
This occurs during the call to Xamarin.Essentials.Geocoding.PlatformGetPlacemarksAsync. Here’s the relevant code snippet:
var location = await Geolocation.GetLocationAsync(new
GeolocationRequest {
DesiredAccuracy = GeolocationAccuracy.Medium });var placemarks = await Geocoding.GetPlacemarksAsync(location);
CurrentLocation = placemarks?.FirstOrDefault();