Pokéhacking

Several months ago, my iPhone started telling me I was at Union Square in San Francisco. Specifically, at the corner of Geary and Powell. No matter where I’d go, I was always in Union Square.

Here I am (not)

I tried everything I could think of to fix my location — switching to Airplane Mode, toggling Wi-Fi and Location Services, resetting Location and Privacy settings — all to no avail. The only thing that seemed to work was rebooting my phone. Eventually I went to the Genius Bar, and while they could find nothing wrong with my iPhone 6s, they figured it was most likely a hardware problem and replaced my device.

Not too long after, the problem recurred on my new device. I tried wiping my phone and restoring from iCloud to rule out a bad system setting, and it recurred again. I was so frustrated I wrote an app that would constantly monitor my location and send me a push notification if it thought I was in Union Square. I ran that for a while and the problem didn’t occur, so I thought maybe constant location tracking would prevent it, and I killed the app to see if it would come back.

It did. But since I’m not checking my map all the time, I still couldn’t figure out what triggered it. I did notice that it seemed to happen once after I ran another iOS app from Xcode, but rather than making a causal connection, I just went looking at the device logs to see if there were any hints. There weren’t.

What’s this have to do with Pokémon?

Don’t worry. I’m getting there.

While I don’t look at the map frequently, I have developed a horrible habit of playing Pokémon Go, which also shows where I am. Being in Union Square in Pokémon Go is actually not bad, because all the stops are always loaded with lures.

Union Square in Pokémon Go

Since I’m constantly checking Pokémon Go, I realized quickly that my stuck location was definitely triggered by running my own app from Xcode. It still wasn’t clear to me why, until a colleague reminded me that you can simulate location in Xcode.

Sure enough, I had location simulation enabled and set to San Francisco. Apparently the point used for SF is right there on the corner of Geary and Powell.

What surprised me is that location simulation affects the entire system, not just the app you’re debugging. And you can update your location on the fly by choosing another location from the menu. So even with my app in the background and Pokémon Go in the foreground, I can hop around the world and see what Pokémon there are in different places.

Caveat

I’ll admit I briefly thought about jumping from location to location, farming Poké Balls and rare Pokémon. However, Niantic appears to be one step ahead of me. While you can indeed travel the world in Pokémon Go this way, you may not want to.

When I was stuck in Union Square, I could play the game just fine. But when I traveled to far-flung locations, spinning Pokéstops did not yield anything, and every Pokémon I caught escaped and then disappeared in that familiar puff of smoke. I’m assuming this is because my account has been flagged for hacking location. Now I can’t even play at my actual location, or even on another device.

Thank you, Niantic, for helping me break the habit.

Poof