O'Reilly logo

iPhone Location Aware Apps by Example by Zeeshan Chawdhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — boundary monitoring with Location Manager

Let's now move to the next Location Service provided by the iOS Location Manager — Region/Boundary Monitoring. We use the CLRegion class and its method, namely, didEnterRegion to monitor whether the user's position falls in the boundary.

  1. Open the Hello Location project. In the Hello_locationViewController.h file, add the CLRegion definition as follows:
    CLRegion *boundary;
    
  2. In the Hello_LocationViewController.m file, we create a circular boundary/region centered around San Francisco geo co-ordinates, with a radius of 1000 meters. We initialize the boundary variable as the following:
    CLLocationCoordinate2D regionCords = CLLocationCoordinate2DMake (37.78 , -122.408); boundary = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required