Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accidentally overwrote iPhone device location via Xcode

Tags:

So I'm working on a location-based iPhone app. I'm mainly testing on the iOS simulator, and as such using the Core Location Simulation. All good - I can pretend to be in New York or San Francisco or wherever.

Then I move to testing my app on my iPhone, with that checkbox still enabled. I go for a walk (in, like, the actual real world), pull out Google Maps, and realise that my actual, not-simulator iPhone is using a simulated location. In this instance my iPhone is stuck thinking that it's in London (where I live), but right central in Picadilly Circus, not where I am.

I get home, open up Xcode, and to make sure I've nailed down the cause (rather than just a weird GPS bug etc), change the 'default location' to Johannesburg. Unplug my phone, open Google Maps (and Foursquare, to be sure), same deal. Stuck in Johannesburg.

So it's definitely this panel here that's borked my phone, but I can't figure out how to reset it.

Things I've tried that don't seem to work:

  • changing 'default location' to 'none' & rerunning
  • disabling 'allow location simulation' & rerunning

So it seems once you've given your iPhone an arbitrary location to pretend to be in, just disabling that doesn't fix it.

Location Simulation

Any ideas? I'm going travelling in a few days and really need my GPS to work!

like image 409
Jon Gold Avatar asked Oct 08 '14 15:10

Jon Gold


1 Answers

While you have your device connected to the debugger there is a little button at the top of the debug panel. Right here:

enter image description here

Click on that and you can select 'don't simulate location', exit the app, and I think you'll be good to go.

I'm a little foggy too on how that relates to the location defined in the scheme and the location set in the simulator. I usually find it easier to set a location in the simulator itself rather than in the scheme (at least when testing in the simulator is possible) to avoid issues like this. In the simulator if you enter a location under 'Debug > Location > Custom Location...' while the simulator is on the springboard the location will persist between launches of the app and the simulator.

like image 96
Anthony Mattox Avatar answered Oct 29 '22 17:10

Anthony Mattox