Lesson 29
Where Am I? Introducing Core Location
Core Location is a framework that allows applications to retrieve the location and heading of the device they are running on. To do this, Core Location can use a combination of a compass for heading, and either GPS, cellular radio, or WiFi technologies for location. Cellular radio and WiFi-based location is less accurate than GPS.
Applications cannot specify which method will be used, but they can specify a desired level of accuracy. Depending on the desired level of accuracy, Core Location tries to use the GPS hardware, cellular radio, or WiFi in that order.
This framework is not included in any of the standard iOS application templates. To use this framework in your code, you will need to add it manually to your project. You can do this from the Project Settings page in Xcode. Select the project node in the project navigator to display the settings page. On the settings page, switch to the Build Phases tab and click the + button under the Link Binary With Libraries category. Select CoreLocation.framework from the list of available frameworks (see Figure 29.1).
Core Location defines a manager class called CLLocationManager
that you can use to interact with the framework. It allows you to specify the desired frequency and accuracy of location information. To receive location updates in an application, you need to ...
Get Swift iOS 24-Hour Trainer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.