Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

3. Using Location in your iOS Apps — Cor... > Time for action — boundary monitorin...

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 = [[CLRegion alloc]initCircularRegionWithCenter:regionCords radius:1000.0f identifier:@"San Francisco"];
    

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint