Chapter 2. Core Location

Core Location can provide the latitude, longitude, and altitude of the user’s device, along with the level of accuracy to which this information is known, and the direction in which the device is moving. If a magnetometer is present, the framework can also return the device heading and the accuracy to which that is known.

The Standard Location Service

The Core Location framework is an abstraction layer on top of three main methods of geolocation:

  1. The least accurate level uses the cell network to locate the user (the process is similar to triangulation but more complex). This can quickly provide a position to around 12 km accuracy, which can be reduced to 2−3 km after some time, depending on the tower density at your current location.

  2. The next accuracy level is obtained by utilizing a WiFi-based positioning system. This is much more precise, giving a position to approximately 100 m. However, it requires the user to be in range of a wireless hotspot that is tracked by the system.

  3. Finally, the highest level of accuracy is obtained by using GPS hardware, if present, which should provide a position to less than 40 m.

Since the framework is intended to abstract both the user and the developer from the hardware layer, it—perhaps unfortunately—does not provide any way to get direct information about the availability of specific hardware (for instance, the availability of GPS).

Therefore, as a developer the only control you have over which method is used to determine the ...

Get Geolocation in iOS 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.