Last active
August 7, 2017 11:06
-
-
Save software-mariodiana/7176015 to your computer and use it in GitHub Desktop.
Reworking CoreLocation methods deprecated in iOS 7.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not getting called when i entered the region .
can provide complete tutorial ?