Skip to content

Instantly share code, notes, and snippets.

@ryanmasondavies
Last active August 29, 2015 13:57
Show Gist options
  • Save ryanmasondavies/9630433 to your computer and use it in GitHub Desktop.
Save ryanmasondavies/9630433 to your computer and use it in GitHub Desktop.
Using CLLocationManager and CLRegion to detect proximity to the Eiffel Tower
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
[self setLocationManager:locationManager];
// ...
CLLocationCoordinate2D eiffelTowerCoordinates = CLLocationCoordinate2DMake(48.858093, 2.294694);
CLLocationDistance radius = 20; // 20 meters
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:eiffelTowerCoordinates radius:20.0 identifier:@"Eiffel Tower"];
[[self locationManager] startMonitoringForRegion:region];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment