If you like my tutorials, you will love my book . It is chockful of advanced programming techniques and the only comprehensive barcode reference for serious iOS developers.
Our DNA is written in Objective-C

Locating Controversy

Now that most everybody is buying into the (probably false) rumor that the iPhone 5 will be coming in Fall, the news media were only too happy to latch onto the fact that there is a database of locations on user’s desktops that could be used to infer his location information.

Last week a young cousin-in-law of mine came to me touting “did you know that the iPhone tracks you everywhere?” to which I already had formed an opinion and response. The iPhone does not track YOU. And on famous podcasts like the ones of the TWIT network you keep hearing the false information that it is indeed GPS locations that are recorded. Not so.

In this article I will debunk some of the myths so that you don’t have to stand idly by while people are talking nonsense and thus might be tarnishing the otherwise squeaky clean image of our beloved iOS platform.

Two people banded together and started a class action lawsuit claiming that they would not have purchased an Apple device would they only have know that this tracking problem existed. Well actually, the lawsuit has not been started as such. It only has been filed. Still the headline reads “Apple smacked with a lawsuit over iPhone Location Tracking”. Sensation seeking bastards.

The other kind of crowd that tends to latch onto public controversies are politicians. They usually do so by a public letter that asks some open ended questions and the usual purpose is to demonstrate how much they are in touch with the fears and hopes of their constituents. One such example was Ars Technica writing that Sen. Al Franken (D-MN) wants answers, under a headline – of course – that also contained the word “scandal”.

Steve Jobs himself responded with more text than the usual one-liner:

Q: Steve,

Could you please explain the necessity of the passive location-tracking tool embedded in my iPhone? It’s kind of unnerving knowing that my exact location is being recorded at all times. Maybe you could shed some light on this for me before I switch to a Droid. They don’t track me.

A: Oh yes they do. We don’t track anyone. The info circulating around is false.

Sent from my iPhone

If Apple can successfully argument that this is indeed a software bug and remedy it, then the whole suit falls apart. Apple surely did not have any nefarious intent and thus neither the sought injunction nor the class action status has merit. This will probably never see the inside of a courthouse, the two guys will get a show of good faith, probably either their money back for their “accidentally purchased” devices or maybe a nice MacBook Air each?

Nothing to see here, Move along…

The whole controversy started with some “Security Researchers” poking around an unencrypted iTunes backup. This job description usually means that they are unemployed hackers looking for some gem to get money or fame for. Alasdair Allan describes himself as “Yet another hacker, pretending to be an Astronomer, pretending to be a hacker.”

Unemployed as in “running a small technology consulting business” and “book author”. QED. Nothing against small tech biz, I am guilty of the same. If I found a similar problem then I would also be looking for fame and fortune.

Don’t get me wrong, I’m NOT dissing legitimate security researchers or small business owners or hackers in general. Alex Levinson already debunked this “latest discovery” as being several months old. The only novel idea was to put it into a Mac app that displays it on an OpenStreetmap. And to get big O’Reilly to hire them for a talk.

Paul and Alasdair aptly named their talk on the Where 2.0 conference (also by O’Reilly like most of their books) The Business of Location. The original title was too long: “How we are getting famous and rich by showing how evil Apple is tracking your ass”.

So what’s the real deal? Actually the original blog post has most of the facts. Though the information copying blogger crowd seems to – intentionally or not – omit some of them to stir up even greater controversy.

Fact: Beginning with iOS 4.0 locations are being added to a sqlite database on the device.

Fact: All files are backed up via iTunes.

Fact: Restoring such a backup also restores this location database to a new device.

Fact: If the back up is not encrypted then you can use tools to browse the contents of it.

Nothing here …

Myth: “easily-readable form”. Try to go to ~/Library/Application Support/MobileSync/Backup and even find this consolidated.db. You’ll fail, unless you have extra tools. Fortunately for us n00bs Pete Warden put together an app that finds the latest consolidated.db and displays the locations on an OpenStreetmap.

But, the first “But”… this tool only goes for the latest backup. If you’re like me and have multiple iOS devices then there’s no way to select a different device. So all I was able to get is the view for my iPad2.

Myth: “your GPS location is being tracked”. Have a look at the locations for my DropsPad2. Now pinpoint where I am as I am writing this article. You will fail because there is not a single point close to my house. Not even close. I do have two WiFi networks which can used by CoreLocation, but these don’t show up. These are only cell towers. There is no GPS-level data to be found.

Myth: “from the cell tower locations the user’s position can be pinpointed”. Good luck with that! As I already told you, “pin pointing” would require accuracy or in the least information which section antenna of a cell tower you where connected to. PIN and POINT suggest that there is some information in there, that is clearly not. Just going by the fatter dots in the picture above you might be tempted to think that I am probably in the city on the left center. WRONG. That’s Steyr and I’ve never been there with my iPad2. I’ve only been to my home in Weistrach (near the center of the image) and to my doctor’s a bit east.

If this data would include the location of WiFi base stations then it would be way more useful for spying on somebody.

Or Here …

You might be able to guess accurately the country or county a person was in. And that’s for small Austria. The video on the iPhoneTracker FAQ page looks so accurate because it is way zoomed out so that the encountered cell towers look very closely together. With lots of phantasy these black blogs could be seen as “points”. So I grant  you maybe city level accuracy from also considering the time stamps. But accuracy rivaling the point of a pin? No way.

Myth: “you are being tracked without your consent”. As I have already shown you are not being tracked and if you were you would have given your consent. In the iPhone 4 Software License Agreement refer to section 4 b). Funny, the relevant paragraph was already set in bold by Apple.

(b) Location Data. Apple and its partners and licensees may provide certain services through your iPhone that rely upon location information. To provide and improve these services, where available, Apple and its partners and licensees may transmit, collect, maintain, process and use your location data, including the real-time geographic location of your iPhone, and location search queries. The location data and queries collected by Apple are collected in a form that does not personally identify you and may be used by Apple and its partners and licensees to provide and improve location-based products and services. By using any location-based services on your iPhone, you agree and consent to Apple’s and its partners’ and licensees’ transmission, collection, maintenance, processing and use of your location data and queries to provide and improve such products and services. You may withdraw this consent at any time by going to the Location Services setting on your iPhone and either turning off the global Location Services setting or turning off the individual location settings of each location-aware application on your iPhone. Not using these location features will not impact the non location-based functionality of your iPhone. When using third party applications or services on the iPhone that use or provide location data, you are subject to and should review such third party’s terms and privacy policy on use of location data by such third party applications or services.

If you are afraid of being tracked then disable location services. It’s as easy as that.

Though wait a minute … it’s not as simple. People at the Wall Street Journal have tested if this database also gets populated with location services turned off. And luckily for everybody who likes to see Apple stumble IT DOES. Though they are claiming that it collects “The location data using cellphone towers and Wi-Fi access points near a user’s phone” which does not match up with my observations. I only see cell towers.

Or Here …

Actually it’s not just Apple who keeps track of cell tower locations. Google’s Android does it as well, and even more accurately because there the cache indeed DOES include WiFi locations. You can dump these with this handy tool. And even Windows mobile phone has a similar cache. Seems like everybody is suddenly caching location information. Is that nefarious or rather meant to speed up getting a location for location-aware apps?

Now this is not really comparing Apples with Apples. Certainly CoreLocation has a cache too, possibly also including GPS and WiFi coordinates but it is well hidden on the device and possibly only in RAM. So the one question remains as to why there’s a need for a persistent database of cell towers.

The consolidated.db came into existence with iOS 4, so there must be a link to the new features that got introduced at that time. And there are actually two kinds of features we find in the iOS 4.0 API diffs that would make perfect sense:

The Core Location framework now supports the following features:

  • A location monitoring service that tracks significant changes using only cellular information. This solution offers a lower-power alternative for determining the user’s location.
  • The ability to define arbitrary regions and detect boundary crossings into or out of those regions. This feature can be used for proximity detection regardless of whether the application is running.

In both cases the cell tower locations are used to save power on getting a crude idea if a user has entered or left a general region. An app implementing that could be essentially terminated and be restarted the next time a significant location change has been detected. The monitoring of regions is only available on iPhone 4 and above. Significant location changes are able to be used on all iPhones.

The idea behind this lower-power method of a general region is that it might be sufficient to wake/launch an app when you get close to a defined region thus saving CPU cycles by not having to have CoreLocation constantly enabled and monitoring the location.

The celltower cache has to be persisted because this increases the available resolution for these two features over time as more towers get inserted into the database. Apple does not have to include a database of all celltowers because only the ones that are seen by the device are actually relevant. This approach is so smart that Apple even filed a patent for it in 2009, a year before iPhone 4 was launched.

Why does it have to keep the cell tower information around for so long? Because cell towers typically don’t change in position once they have been erected. And more towers mean more accurate low-power region monitoring.

Controversy Not Found

So we see that there is a good technical reason for the existence and persistence of this database. We don’t have to actually do anything about it because the controversy about it has been way overhyped by attention-seeking hackers, bloggers and even the media.

Apple forgot to include the this data collection mechanism in the Location services opt-out switch. Who wants to wager that this will be changed in the next iOS update? And while their at it, maybe also remove the cell tower timestamps from the database schema. Or if those actually get used for the region monitoring, then it might be wiser to remove them from the db after a couple of days.

If you are worried that somebody might have use for the information which cities you visited you can easily encrypt your backup and be done with it.

Don’t believe everything bad about Apple that you read. Success breeds contempt.

Update, later the same day

Interestingly enough Apple published a press release titled Q&A on Location Data. Their answers are in line with my above analysis. The locations in consolidated.db are not even yours. They are an extract from a crowd-sourced database of cell towers and WiFi hotspots that aids in getting a faster fix.

As to the duration of the measurements, Apple admitted that this is a bug and they will reduce it to 7 days in the next update. To this they say:

Sometime in the next few weeks Apple will release a free iOS software update that:

  • reduces the size of the crowd-sourced Wi-Fi hotspot and cell tower database cached on the iPhone,
  • ceases backing up this cache, and
  • deletes this cache entirely when Location Services is turned off.

There are two additional interesting tidbits in the press release: this now proves that Apple is employing our devices to build a crowd-sourced location database of celltowers and WiFi hotspots. Apple had hinted at that in a previous response to a congressional inquiry.

For devices running the iPhone OS versions 1.1.3 to 3.1, Apple relied on (and still relies on) databases maintained by Google and Skyhook Wireless (“Skyhook”) to provide location-based services. Beginning with the iPhone OS version 3.2 released in April 2010, Apple relies on its own databases to provide location-based services and for diagnostic purposes. This databases must be updated continuously to account for, among other things, the ever-changing physical landscape, more innovative uses of mobile technology, and the increasing number of Apple’s customers.

And the other thing is that apparently Apple is collecting anonymous information on the flow of traffic to be able to give you a better trafic service “in the next couple of years”.

Thanks to this response we can now close the matter and move on to more productive work.

Categories: Apple


  1. Great article. I think your conclusions make perfect sense.

  2. And with all this furor, what I fail to have seen mentioned (or jumped up and down about) is the fact that the various cell carriers have had access to the same information (i.e. which cell tower you’re connected to) at every moment that your cell phone is turned on. Even if you don’t have an iPhone. And they’ve had this for years. Think they might be using some of that information somewhere? If you say “no,” IMHO you have a very naive outlook…

  3. Awesome detail. Thanks for the hard work!

Leave a Comment

%d bloggers like this: