Fixed iOS 7 test breakage and crash from #1382

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.
This commit is contained in:
Minh Nguyễn
2015-04-30 16:02:20 -04:00
parent 812448f830
commit 5780b676b0

View File

@@ -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