Sunday, December 27, 2015

Simulate location routes when debugging in Xcode

If you want to simulate a route when debugging in Xcode, you'll need to create a gpx file add it to your Xcode project and then choose it when you run your app.

The hardest part is to create a gpx file. Xcode requires gpx files to be in a specific format.
So first create a gpx format by one of the available online map services. I used Graphhopper with satisfactory results (https://graphhopper.com/maps/).
Next, translate the resulting file to a format that Xcode will understand using the tool gpsbabel (on the Mac gpsbabel can be easily installed using homebrew).

gpsbabel -i gpx -f input.gpx -x transform,wpt=trk -o gpx -F output.gpx

And that's it.

No comments:

Post a Comment