Reworking CoreLocation methods deprecated in iOS 7.
/*
* Several methods from CoreLocation were deprecated in iOS 7. Some were replaced
* by methods in other classes. Here are some very bare notes describing how to
* circumscribe a region and then use that region to do geofencing.
*/
static NSString *ExeterAppleStoreRegion = @"XYZMyAppExeterAppleStoreRegion";
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(50.72451, -3.52788);
CLLocationDistance radius = 30.0;
CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:center
radius:radius
identifier:ExeterAppleStoreRegion];
if ([CLLocationManager isMonitoringAvailableForClass:[region class]]) {
// Apple's documentation says to check authorization after determining monitoring is available.
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
[[self locationManager] startMonitoringForRegion:region];
}
}