Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CHLibrarian/b77f33f3c577feccf18a to your computer and use it in GitHub Desktop.
Save CHLibrarian/b77f33f3c577feccf18a to your computer and use it in GitHub Desktop.
ContextHub Element Services Geofence Retrieve Tags Gist
// Getting all geofences with the tag "geofence-tag" near our location in 2000 meter radius
// currentLocation is our current location from CLLLocationManager
NSString *geofenceTag = @"geofence-tag";
[[CCHGeofenceService sharedInstance] getGeofencesWithTags:@[geofenceTag] location:currentLocation radius:2000 completionHandler:^(NSArray *geofences, NSError *error) {
if (!error) {
for (NSDictionary *geofenceDict in geofences) {
CLCircularRegion *geofenceRegion = [CCHGeofenceService regionForGeofence:geofenceDict];
}
} else {
NSLog(@"Could not get geofences from ContextHub");
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment