Book Image

Learning ibeacon

By : Craig Gilchrist
Book Image

Learning ibeacon

By: Craig Gilchrist

Overview of this book

Table of Contents (16 chapters)
Learning iBeacon
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a CLLocationManager class


The CLLocationManager class is used to track both geolocation and proximity based on beacons. To start tracking beacon regions using the CLLocationManager class, we need to do the following:

  1. Create an instance of CLLocationManager.

  2. Assign an object conforming to the CLLocationManagerDelegate protocol to the delegate property.

  3. Call the appropriate start method to begin the delivery of events.

All location- and heading-related updates are delivered to the associated delegate object, which is a custom object that you provide.

Defining a CLLocationManager class line by line

Consider the following steps to define a CLLocationManager class line by line:

  1. Every class that needs to be notified about CLLocationManager events needs to first import the Core Location framework (usually in the header file) as shown:

    #import <CoreLocation/CoreLocation.h>
  2. Then, once the framework is imported, the class needs to declare itself as implementing the CLLocationManagerDelegate...