From 020b4663d975fe4fd81c74ffeba5592b5fa98ab9 Mon Sep 17 00:00:00 2001 From: Gregory Moore Date: Sun, 23 May 2021 12:53:18 -0500 Subject: [PATCH] Only Process Most Recent Location --- .../Apple/GeolocatorImplementation.apple.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Geolocator.Plugin/Apple/GeolocatorImplementation.apple.cs b/src/Geolocator.Plugin/Apple/GeolocatorImplementation.apple.cs index de5c6a1..a2e69ef 100644 --- a/src/Geolocator.Plugin/Apple/GeolocatorImplementation.apple.cs +++ b/src/Geolocator.Plugin/Apple/GeolocatorImplementation.apple.cs @@ -492,8 +492,10 @@ CLLocationManager GetManager() void OnLocationsUpdated(object sender, CLLocationsUpdatedEventArgs e) { - foreach (var location in e.Locations) - UpdatePosition(location); + if (e.Locations.Any()) + { + UpdatePosition(e.Locations.Last()); + } // defer future location updates if requested if ((listenerSettings?.DeferLocationUpdates ?? false) && !deferringUpdates && CanDeferLocationUpdate)