lichen19853 lichen19853 - 2 months ago 26
iOS Question

When using GPX in Xcode to simulate location changes, is there a way to control the speed?

I'm using the following GPX file in Xcode 4.2 to simulate a location change. It works well, but I can't control the speed of the location change. stamp seems to be not working. Does anyone have a solution for this?

<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode">
<wpt lat="37.331705" lon="-122.030237"></wpt>
<wpt lat="37.331705" lon="-122.030337"></wpt>
<wpt lat="37.331705" lon="-122.030437"></wpt>
<wpt lat="37.331705" lon="-122.030537"></wpt>
</gpx>

Answer

I don't think (know) that this is possible in the GPX directly, but you can test location change with Instruments/Automation.

You'd use a script like:

var target = UIATarget.localTarget();
target.setLocation(<location);
target.delay(5);
target.setLocation(...);

And so on. I took this example from the WWDC11 video https://deimos.apple.com/WebObjects/Core.woa/BrowsePrivately/adc.apple.com.8266314619.08266314625.8367850271 (Testing your location-aware applications)

I'm aware that this doesn't actually let you define the speed, but the delays somehow account for that I hope. Maybe that'll help you.