CCLocation с startMonitoringForRegion больше не работает с iOS 10
Я использую этот код, потому что iOS 10, и он работал хорошо.
//Start monitoring
CLLocationCoordinate2D centre;
centre.latitude = [latZone floatValue];
centre.longitude = [lonZone floatValue];
[self.locationManager startMonitoringForRegion:[[CLCircularRegion alloc] initWithCenter:centre radius:[radiusZone floatValue] identifier:nameZone]];
Но, начиная с версии iOS 10, она больше не работает. Он не вызывает didEnterRegion: didExitRegion: & didStartMonitoringForRegion:
Есть идеи?
1 ответ
Решение
Я наконец решил это, добавив два ключа в info.plist:
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
И добавив эти две строки прямо перед:
[self.locationManager requestAlwaysAuthorization];
[self.locationManager requestWhenInUseAuthorization];