diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 815ecb4bc..78eb12342 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.3.8 + +* Uses different `CLLocationManager` instances, for one time request location and persistent request location. +* Fixes a bug where iOS location settings, e.g. `accuracy` and `distanceFilter` are overridden by different calls. +* Updates minimum deployment target to `iOS 11` as lower is not supported anymore by Xcode. + ## 2.3.7 * Adds privacy manifest. diff --git a/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m b/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m index a9a6f8e6c..f0932cc67 100644 --- a/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m +++ b/geolocator_apple/example/ios/RunnerTests/GeolocationHandlerTests.m @@ -19,14 +19,18 @@ @interface GeolocationHandlerTests : XCTestCase @implementation GeolocationHandlerTests { CLLocationManager *_mockLocationManager; + CLLocationManager *_mockOneTimeLocationManager; + GeolocationHandler *_geolocationHandler; } - (void)setUp { _mockLocationManager = OCMClassMock(CLLocationManager.class); + _mockOneTimeLocationManager = OCMClassMock(CLLocationManager.class); _geolocationHandler = [[GeolocationHandler alloc] init]; [_geolocationHandler setLocationManagerOverride:_mockLocationManager]; + [_geolocationHandler setOneTimeLocationManagerOverride:_mockOneTimeLocationManager]; } #pragma mark - Test requesting current location @@ -36,25 +40,25 @@ - (void)testGetCurrentPositionShouldCallStartUpdatingLocation { resultHandler:^(CLLocation * _Nullable location) {} errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; - OCMVerify(times(1), [self->_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); - OCMVerify(times(1), [self->_mockLocationManager startUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager startUpdatingLocation]); } - (void)testRequestPositionShouldReturnLocationWithinTimeConstraints { NSDate *now = [NSDate date]; NSCalendar *calendar = [NSCalendar currentCalendar]; - + CLLocation *firstLocation = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.0, 6.4) altitude:0.0 horizontalAccuracy:0 verticalAccuracy:0 timestamp:[calendar dateByAddingUnit:NSCalendarUnitSecond value:-6 toDate:now options:0]]; CLLocation *secondLocation = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.1, 6.4) - altitude:0.0 - horizontalAccuracy:0 - verticalAccuracy:0 - timestamp:now]; - + altitude:0.0 + horizontalAccuracy:0 + verticalAccuracy:0 + timestamp:now]; + XCTestExpectation *expectation = [self expectationWithDescription:@"expect result return third location"]; [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest @@ -64,20 +68,20 @@ - (void)testRequestPositionShouldReturnLocationWithinTimeConstraints { } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[firstLocation]]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[secondLocation]]; - + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[firstLocation]]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[secondLocation]]; + [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldStopListeningOnResult { CLLocation *location = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(54.1, 6.4) - altitude:0.0 - horizontalAccuracy:0 - verticalAccuracy:0 - timestamp:[NSDate date]]; + altitude:0.0 + horizontalAccuracy:0 + verticalAccuracy:0 + timestamp:[NSDate date]]; XCTestExpectation *expectation = [self expectationWithDescription:@"expect first result return third location"]; [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest @@ -88,11 +92,11 @@ - (void)testRequestPositionShouldStopListeningOnResult { }]; - [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[location]]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didUpdateLocations: @[location]]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldStopListeningOnError { @@ -107,11 +111,11 @@ - (void)testRequestPositionShouldStopListeningOnError { }]; - [_geolocationHandler locationManager:_mockLocationManager didFailWithError: error]; + [_geolocationHandler locationManager:_mockOneTimeLocationManager didFailWithError: error]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; - OCMVerify(times(1), [self->_mockLocationManager stopUpdatingLocation]); + OCMVerify(times(1), [self->_mockOneTimeLocationManager stopUpdatingLocation]); } - (void)testRequestPositionShouldNotStopListeningOnErrorDomainAndErrorLocationUnknown { @@ -158,7 +162,7 @@ - (void)testStartListeningShouldNotStopListeningWhenListeningToStream { - (void)testRequestingPositionWhileListeningDoesntStopStream { CLLocation *mockLocation = [[CLLocation alloc] initWithLatitude:54.0 longitude:6.4]; XCTestExpectation *expectationStream = [self expectationWithDescription:@"expect result return third location"]; - XCTestExpectation *expectationForeground = [self expectationWithDescription:@"expect result return third location"]; + XCTestExpectation *expectationForeground = [self expectationWithDescription:@"expect result return third location"]; [_geolocationHandler startListeningWithDesiredAccuracy: kCLLocationAccuracyBest distanceFilter:0 pauseLocationUpdatesAutomatically:NO @@ -172,14 +176,14 @@ - (void)testRequestingPositionWhileListeningDoesntStopStream { errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { }]; - + [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyHundredMeters resultHandler:^(CLLocation * _Nullable location) { - XCTAssertEqual(location, mockLocation); - [expectationForeground fulfill]; - } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; + XCTAssertEqual(location, mockLocation); + [expectationForeground fulfill]; + } errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; [_geolocationHandler locationManager:_mockLocationManager didUpdateLocations: @[mockLocation]]; [self waitForExpectationsWithTimeout:5.0 handler:nil]; @@ -236,39 +240,39 @@ - (void)testStartListeningShouldNotReportErrorOnErrorDomainAndErrorLocationUnkno } - (void)testListeningBackgroundGeolocationOnlyWhenAllowedAndEnabled { - id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); - [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; - OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); - [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:NO - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:YES - resultHandler:^(CLLocation * _Nullable location) { - } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; - OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); + id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); + [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; + OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); + [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:NO + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); } - (void)testNotListeningBackgroundGeolocationWhenNotEnabled { - id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); - [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; - OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); - [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:NO - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:NO - resultHandler:^(CLLocation * _Nullable location) { - } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { - - }]; - OCMVerify(never(), [_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); + id geolocationHandlerMock = OCMPartialMock(_geolocationHandler); + [geolocationHandlerMock setLocationManagerOverride:_mockLocationManager]; + OCMStub(ClassMethod([geolocationHandlerMock shouldEnableBackgroundLocationUpdates]))._andReturn([NSNumber numberWithBool:YES]); + [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:NO + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:NO + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify(never(), [_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); } - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { @@ -283,14 +287,14 @@ - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { ._andReturn([NSNumber numberWithBool:YES]); } [geolocationHandlerMock startListeningWithDesiredAccuracy: kCLLocationAccuracyBest - distanceFilter:0 - pauseLocationUpdatesAutomatically:NO - showBackgroundLocationIndicator:YES - activityType:CLActivityTypeOther - allowBackgroundLocationUpdates:YES - resultHandler:^(CLLocation * _Nullable location) { + distanceFilter:0 + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:YES + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { } - errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { }]; OCMVerify([_mockLocationManager setAllowsBackgroundLocationUpdates:YES]); @@ -306,4 +310,29 @@ - (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition { } } +- (void)testKeepLocationManagerSettingsWhenRequestingCurrentPosition1 { + [_geolocationHandler startListeningWithDesiredAccuracy:kCLLocationAccuracyThreeKilometers + distanceFilter:kCLLocationAccuracyThreeKilometers + pauseLocationUpdatesAutomatically:NO + showBackgroundLocationIndicator:YES + activityType:CLActivityTypeOther + allowBackgroundLocationUpdates:YES + resultHandler:^(CLLocation * _Nullable location) { + } + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) { + + }]; + OCMVerify([_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyThreeKilometers]); + OCMVerify([_mockLocationManager setDistanceFilter:kCLLocationAccuracyThreeKilometers]); + + [_geolocationHandler requestPositionWithDesiredAccuracy:kCLLocationAccuracyBest + resultHandler:^(CLLocation * _Nullable location) {} + errorHandler:^(NSString * _Nonnull errorCode, NSString * _Nonnull errorDescription) {}]; + OCMVerify([_mockOneTimeLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify([_mockOneTimeLocationManager setDistanceFilter:kCLDistanceFilterNone]); + + OCMVerify(never(), [_mockLocationManager setDesiredAccuracy:kCLLocationAccuracyBest]); + OCMVerify(never(), [_mockLocationManager setDistanceFilter:kCLDistanceFilterNone]); +} + @end diff --git a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m index c4e9cf4a3..72c5cfe11 100644 --- a/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m +++ b/geolocator_apple/example/ios/RunnerTests/GeolocatorPluginTests.m @@ -336,7 +336,7 @@ - (void)testOpenAppSettings { if (@available(iOS 8, *)) { id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); + OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); @@ -394,7 +394,7 @@ - (void)testOpenLocationSettings { if (@available(iOS 8, *)) { id mockApplication = OCMClassMock([UIApplication class]); - OCMStub([mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); + OCMStub([(UIApplication *)mockApplication openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]).andReturn(YES); OCMStub(ClassMethod([mockApplication sharedApplication])).andReturn(mockApplication); diff --git a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m index 0ebc96bd5..6deda5631 100644 --- a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m +++ b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler.m @@ -13,12 +13,12 @@ @interface GeolocationHandler() -@property(assign, nonatomic) bool isListeningForPositionUpdates; - @property(strong, nonatomic, nonnull) CLLocationManager *locationManager; - @property(strong, nonatomic) GeolocatorError errorHandler; +@property(strong, nonatomic, nonnull) CLLocationManager *oneTimeLocationManager; +@property(strong, nonatomic) GeolocatorError oneTimeErrorHandler; + @property(strong, nonatomic) GeolocatorResult currentLocationResultHandler; @property(strong, nonatomic) GeolocatorResult listenerResultHandler; @@ -32,8 +32,7 @@ - (id) init { if (!self) { return nil; } - - self.isListeningForPositionUpdates = NO; + return self; } @@ -49,32 +48,42 @@ - (void)setLocationManagerOverride:(CLLocationManager *)locationManager { self.locationManager = locationManager; } -- (CLLocation *)getLastKnownPosition { +- (CLLocationManager *) getOneTimeLocationManager { + if (!self.oneTimeLocationManager) { + self.oneTimeLocationManager = [[CLLocationManager alloc] init]; + self.oneTimeLocationManager.delegate = self; + } + return self.oneTimeLocationManager; +} + +- (void)setOneTimeLocationManagerOverride:(CLLocationManager *)locationManager { + self.oneTimeLocationManager = locationManager; +} + +- (CLLocation *) getLastKnownPosition { CLLocationManager *locationManager = [self getLocationManager]; - return [locationManager location]; + CLLocation *cashedLocation = [locationManager location]; + if (cashedLocation != nil) { + return cashedLocation; + } + CLLocationManager *persistentLocationManager = [self getOneTimeLocationManager]; + return [persistentLocationManager location]; } - (void)requestPositionWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy resultHandler:(GeolocatorResult _Nonnull)resultHandler errorHandler:(GeolocatorError _Nonnull)errorHandler { - self.errorHandler = errorHandler; + self.oneTimeErrorHandler = errorHandler; self.currentLocationResultHandler = resultHandler; - + BOOL showBackgroundLocationIndicator = NO; BOOL allowBackgroundLocationUpdates = NO; - #if TARGET_OS_IOS - if (self.isListeningForPositionUpdates) { - CLLocationManager *locationManager = [self getLocationManager]; - showBackgroundLocationIndicator = locationManager.showsBackgroundLocationIndicator; - allowBackgroundLocationUpdates = locationManager.allowsBackgroundLocationUpdates; - } - #endif [self startUpdatingLocationWithDesiredAccuracy:desiredAccuracy distanceFilter:kCLDistanceFilterNone pauseLocationUpdatesAutomatically:NO activityType:CLActivityTypeOther - isListeningForPositionUpdates:self.isListeningForPositionUpdates + isListeningForPositionUpdates:NO showBackgroundLocationIndicator:showBackgroundLocationIndicator allowBackgroundLocationUpdates:allowBackgroundLocationUpdates]; } @@ -87,10 +96,10 @@ - (void)startListeningWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy allowBackgroundLocationUpdates:(BOOL)allowBackgroundLocationUpdates resultHandler:(GeolocatorResult _Nonnull )resultHandler errorHandler:(GeolocatorError _Nonnull)errorHandler { - + self.errorHandler = errorHandler; self.listenerResultHandler = resultHandler; - + [self startUpdatingLocationWithDesiredAccuracy:desiredAccuracy distanceFilter:distanceFilter pauseLocationUpdatesAutomatically:pauseLocationUpdatesAutomatically @@ -107,60 +116,61 @@ - (void)startUpdatingLocationWithDesiredAccuracy:(CLLocationAccuracy)desiredAccu isListeningForPositionUpdates:(BOOL)isListeningForPositionUpdates showBackgroundLocationIndicator:(BOOL)showBackgroundLocationIndicator allowBackgroundLocationUpdates:(BOOL)allowBackgroundLocationUpdates - { - self.isListeningForPositionUpdates = isListeningForPositionUpdates; - CLLocationManager *locationManager = [self getLocationManager]; - locationManager.desiredAccuracy = desiredAccuracy; - locationManager.distanceFilter = distanceFilter; - if (@available(iOS 6.0, macOS 10.15, *)) { - locationManager.activityType = activityType; - locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdatesAutomatically; - } +{ + if (isListeningForPositionUpdates) { + CLLocationManager *locationManager = [self getLocationManager]; + locationManager.desiredAccuracy = desiredAccuracy; + locationManager.distanceFilter = distanceFilter; + if (@available(iOS 6.0, macOS 10.15, *)) { + locationManager.activityType = activityType; + locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdatesAutomatically; + } + #if TARGET_OS_IOS - if (@available(iOS 9.0, macOS 11.0, *)) { locationManager.allowsBackgroundLocationUpdates = allowBackgroundLocationUpdates - && [GeolocationHandler shouldEnableBackgroundLocationUpdates]; - } - if (@available(iOS 11.0, macOS 11.0, *)) { + && [GeolocationHandler shouldEnableBackgroundLocationUpdates]; locationManager.showsBackgroundLocationIndicator = showBackgroundLocationIndicator; - } #endif - - [locationManager startUpdatingLocation]; + [locationManager startUpdatingLocation]; + } else { + CLLocationManager *locationManager = [self getOneTimeLocationManager]; + locationManager.desiredAccuracy = desiredAccuracy; + locationManager.distanceFilter = distanceFilter; + [locationManager startUpdatingLocation]; + } } -- (void)stopListening { - [[self getLocationManager] stopUpdatingLocation]; - self.isListeningForPositionUpdates = NO; - self.errorHandler = nil; - self.listenerResultHandler = nil; +- (void)stopOneTimeLocationListening { + [[self getOneTimeLocationManager] stopUpdatingLocation]; + self.oneTimeErrorHandler = nil; + self.currentLocationResultHandler = nil; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { if (!self.listenerResultHandler && !self.currentLocationResultHandler) return; - + CLLocation *mostRecentLocation = [locations lastObject]; NSTimeInterval ageInSeconds = -[mostRecentLocation.timestamp timeIntervalSinceNow]; // If location is older then 5.0 seconds it is likely a cached location which // will be skipped. - if (!self.isListeningForPositionUpdates && ageInSeconds > kMaxLocationLifeTimeInSeconds) { + if (manager == [self getOneTimeLocationManager] && ageInSeconds > kMaxLocationLifeTimeInSeconds) { return; } - + if ([locations lastObject]) { - if (self.currentLocationResultHandler != nil) { - self.currentLocationResultHandler(mostRecentLocation); - } - if (self.listenerResultHandler != nil) { - self.listenerResultHandler(mostRecentLocation); - } + if (self.currentLocationResultHandler != nil) { + self.currentLocationResultHandler(mostRecentLocation); + } + if (self.listenerResultHandler != nil) { + self.listenerResultHandler(mostRecentLocation); + } } - + self.currentLocationResultHandler = nil; - if (!self.isListeningForPositionUpdates) { - [self stopListening]; + if (manager == [self getOneTimeLocationManager]) { + [self stopOneTimeLocationListening]; } } @@ -178,17 +188,16 @@ - (void)locationManager:(CLLocationManager *)manager self.errorHandler(GeolocatorErrorLocationUpdateFailure, error.localizedDescription); } - self.currentLocationResultHandler = nil; - if (!self.isListeningForPositionUpdates) { - [self stopListening]; + if (self.oneTimeErrorHandler) { + self.oneTimeErrorHandler(GeolocatorErrorLocationUpdateFailure, error.localizedDescription); + } + + if (manager == [self getOneTimeLocationManager]) { + [self stopOneTimeLocationListening]; } } + (BOOL) shouldEnableBackgroundLocationUpdates { - if (@available(iOS 9.0, *)) { - return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"] containsObject: @"location"]; - } else { - return NO; - } + return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"] containsObject: @"location"]; } @end diff --git a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h index fed2845de..302b1a7d2 100644 --- a/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h +++ b/geolocator_apple/ios/Classes/Handlers/GeolocationHandler_Test.h @@ -9,4 +9,8 @@ /// This should only be used for testing purposes. - (void)setLocationManagerOverride:(CLLocationManager *)locationManager; +/// Overrides the CLLocationManager instance used by the GeolocationHandler. +/// This should only be used for testing purposes. +- (void)setOneTimeLocationManagerOverride:(CLLocationManager *)locationManager; + @end diff --git a/geolocator_apple/ios/geolocator_apple.podspec b/geolocator_apple/ios/geolocator_apple.podspec index e2ab47f3a..00c7aace5 100644 --- a/geolocator_apple/ios/geolocator_apple.podspec +++ b/geolocator_apple/ios/geolocator_apple.podspec @@ -17,7 +17,7 @@ Pod::Spec.new do |s| s.public_header_files = 'Classes/**/*.h' s.module_map = 'Classes/GeolocatorPlugin.modulemap' s.dependency 'Flutter' - s.platform = :ios, '8.0' + s.platform = :ios, '11.0' # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386'} diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index f3bbe3e7c..befc20365 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: geolocator_apple description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator. repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen -version: 2.3.7 +version: 2.3.8 environment: sdk: ">=2.15.0 <4.0.0"