diff options
-rw-r--r-- | platform/ios/MGLMetricsLocationManager.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/ios/MGLMetricsLocationManager.m b/platform/ios/MGLMetricsLocationManager.m index 2a31d77d3f..a193d9b6ec 100644 --- a/platform/ios/MGLMetricsLocationManager.m +++ b/platform/ios/MGLMetricsLocationManager.m @@ -49,11 +49,17 @@ } - (void)startMonitoringVisits { - [self.locationManager startMonitoringVisits]; + // -[CLLocationManager startMonitoringVisits] is only available in iOS 8+. + if ([self.locationManager respondsToSelector:@selector(startMonitoringVisits)]) { + [self.locationManager startMonitoringVisits]; + } } - (void)stopMonitoringVisits { - [self.locationManager stopMonitoringVisits]; + // -[CLLocationManager stopMonitoringVisits] is only available in iOS 8+. + if ([self.locationManager respondsToSelector:@selector(stopMonitoringVisits)]) { + [self.locationManager stopMonitoringVisits]; + } } #pragma mark CLLocationManagerDelegate |