Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Core Location is easy to use, as demonstrated by the following steps. They walk you through a process of setting up your program to request location data that’s representative of normal use. These steps and Recipe 19-1 provide just one example of using Core Location’s services, showing how you might pinpoint a user’s location:
1. Add the Core Location framework to your project via Project > TARGETS > Build Phases > Link Binaries with Libraries.
2. Check whether the user has enabled Core Location by testing the CLLocationManager class’s locationServicesEnabled class value. Users have the option to switch off Core Location from General > Location Services in the Settings application.
3. Allocate a location manager. Set the manager’s delegate to your primary view controller or application delegate. Optionally, set its desired distance filter and accuracy. The distance filter specifies a minimum distance in meters. The device must move at least this distance before it can register a new update. If you set the distance for 5 meters, for example, you will not receive new events until the device has moved that far. If you plan to test by walking, you probably want to reduce that number.