Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Fixed iOS 7 test breakage and crash from #1382
Browse files Browse the repository at this point in the history
These APIs were introduced in iOS 8+, hence the `-respondsToSelector:` check. But I saw that, thinking it was just redundant, and removed it in #1382, leading to a crash on launch on iOS 7.
  • Loading branch information
1ec5 committed Apr 30, 2015
1 parent 812448f commit 5780b67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions platform/ios/MGLMetricsLocationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ - (void)stopUpdatingLocation {
}

- (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
Expand Down

0 comments on commit 5780b67

Please sign in to comment.