0

Is it possible to check if a given latitude and longitude falls inside of a given GeoFence using iOS 5 APIs? How?

Moshe
  • 56,717
  • 76
  • 267
  • 423

1 Answers1

5

The simple answer is yes:

CLRegion *region = your geofence;
CLLocationCoordinate2D myLocation = CLLocationCoordinate2DMake(38.9, -77.04);
if ([region containsCoordinate:myLocation]) {
   NSLog(@"You're soaking in it.");
}

Note that only circular regions ("fences") are currently supported. See the Location Awareness Programming Guide and the CLRegion Class Reference.

rob mayoff
  • 358,182
  • 62
  • 756
  • 811