From e9532aece05a0ac3db75330e4204661e16cb037f Mon Sep 17 00:00:00 2001 From: yongfeng Date: Mon, 16 Nov 2020 08:12:38 +0800 Subject: [PATCH] fix: INTULocationRequestTypeSingle when requesting permissions always failed even if set timeout --- .../INTULocationManager/INTULocationManager.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/LocationManager/INTULocationManager/INTULocationManager.m b/LocationManager/INTULocationManager/INTULocationManager.m index 3d051ce..40bcb92 100644 --- a/LocationManager/INTULocationManager/INTULocationManager.m +++ b/LocationManager/INTULocationManager/INTULocationManager.m @@ -1101,15 +1101,22 @@ - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { INTULMLog(@"Location services error: %@", [error localizedDescription]); - self.updateFailed = YES; + INTULocationServicesState locationServicesState = [INTULocationManager locationServicesState]; + + self.updateFailed = YES; + for (INTULocationRequest *locationRequest in self.locationRequests) { if (locationRequest.isRecurring) { // Keep the recurring request alive [self processRecurringRequest:locationRequest]; } else { // Fail any non-recurring requests - [self completeLocationRequest:locationRequest]; + if (locationServicesState == INTULocationServicesStateNotDetermined && !locationRequest.hasTimedOut) { + self.updateFailed = NO; + } else { + [self completeLocationRequest:locationRequest]; + } } } }