RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Building Location-Based Applications for the iPhone

Knowing where a device is opens the door to all kinds of innovative applications—and the iPhone's Core Location framework makes discovering location simple.


owadays, it is becoming common to find mobile devices equipped with GPS receivers. Using a GPS receiver, you can pinpoint your current location easily via the many satellites orbiting around earth courtesy of the US government. However, GPS receivers require a clear line-of-sight to the sky to work, so they tend to work poorly or not at all indoors.

Another effective way to locate one's position is through cell tower triangulation. When a mobile phone is on, it stays in constant contact with base stations within range. If you know the identity of these cell towers, it is possible to calculate a phone's physical location by using various databases that contain the cell towers' identity and their exact geographical location. Cell tower triangulation doesn't need satellites, so unlike GPS, it works indoors. However, it is not as accurate as GPS, because its accuracy depends on how closely cell towers are spaced in the area you are in—it works best in densely populated areas where the cell towers are close together.

Author's Note: The first generation iPhone was not equipped with a GPS receiver, and cell tower triangulation does not apply to the iPod Touch because it's not a cellular phone.

Yet a third method is to rely on Wi-Fi triangulation. Using this method, the device connects to a Wi-Fi network and checks the service provider against databases to determine the location serviced by the provider. There's no triangulation and no satellites involved, so this method works wherever the device can connect to a Wi-Fi network, but it's also the least accurate of the three methods.

Core Location Framework

On the iPhone, Apple provides the Core Location framework to help you determine your physical location. The beauty of this framework is that it makes use of all three approaches mentioned here; which method it actually uses at any given time is totally transparent to developers, who need only specify the accuracy they need, and Core Location will go about determining the best way to obtain those results.

Sound amazing? It is. The rest of this article shows how you can do this in code.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date