I'm working on a .NET MAUI application to obtain the user's current location on an iPhone using Geolocation and Geocoding APIs. However, I'm facing an exception when trying to geocode the current location, which occurs only on iOS version 18 and not on iOS 17 and lower. I have also ensured that permissions are correctly set in the Info.plist file. The exception details are as follows when calling Geocoding.GetPlacemarksAsync()
Foundation.NSErrorException: Error Domain=kCLErrorDomain Code=2 "(null)" at Microsoft.Maui.Devices.Sensors.GeocodingImplementation.GetPlacemarksAsync(Double, Double) at DiDe.CabManagement.ViewModels.CancelBookingViewModel.GetLocationAsync()
var status = await
Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>();
if (status != PermissionStatus.Granted) {
// Request permission if it's not already granted
status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>(); }
if (status == PermissionStatus.Granted) {
Location location = await Geolocation.GetLocationAsync();
if (location != null)
{
var placemarks = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude);
App.CurrentLocation = location;
} }