Skip to content

Instantly share code, notes, and snippets.

@software-mariodiana
Last active August 7, 2017 11:06
Show Gist options
  • Select an option

  • Save software-mariodiana/7176015 to your computer and use it in GitHub Desktop.

Select an option

Save software-mariodiana/7176015 to your computer and use it in GitHub Desktop.
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];
}
}
@arjunnna
Copy link

arjunnna commented Aug 7, 2017

  • (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

not getting called when i entered the region .

can provide complete tutorial ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment