diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-04-30 16:02:20 -0400 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-04-30 16:02:20 -0400 |
commit | 5780b676b04baf67670a5f53a69b78f056da73d7 (patch) | |
tree | 99e419abd5c1654ad278d0823f5ed1dbc5228c7c /platform | |
parent | 812448f8302f40e240d2ed484d736878aa6ca855 (diff) | |
download | qtlocation-mapboxgl-5780b676b04baf67670a5f53a69b78f056da73d7.tar.gz |
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.
Diffstat (limited to 'platform')
-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 |