8

I've been reading through a lot of questions/answers relating to the simulation of location on the iOS simulators, but none touching on my specific issue. I have a prototype of a location aware application which I configured to use a GPX file as described in this answer: How to solve Xcode 4.1 (LION) GPS error?

It works great and it provides all the information I need, with one exception. I was expecting the location updates to stop as soon as we moved into the last position defined in the GPX file. Instead, the current location keeps updating in a loop. It returns to the starting position, and loops until you stop it.

I've tried marking positions around the area where I want it to linger at, but it ignores them. It could have something to do with the minimum change in position, but it just ignores it and continues with the loop.

Created a quick project to illustrate the issue and loaded it to GitHub: https://github.com/acolchado/LocationPrototype

To reproduce follow these steps:

  1. Load the project in xcode, I created it using xcode 4.4.1.

  2. Run the project.

  3. From the debug panel, locate the location arrow. Click on the arrow and select "SanBruno_To_Downtown_SF" from the context menu.

  4. Bring the simulator to the foreground and observe the endless loop.

I have looked everywhere for a solution for this, but I am unable to find any mention of the loop. I would greatly appreciate any help anyone could offer here.

Thanks,

Agustin

Community
  • 1
  • 1
acolchado
  • 531
  • 1
  • 4
  • 10

3 Answers3

4

my cheat:

just copy paste the last waypoint in your .gpx file a bunch of times (enough to keep it stuck there until it satisfies your criteria)

Nitin Alabur
  • 5,812
  • 1
  • 34
  • 52
3

You can also add a timestamp in the gpx file. Make yourself linger at the last stop by having a really long timestamp.

1

What worked for me was a combination of the other two answers plus modifying the last/duplicated coordinate slightly.

  1. Duplicate the last coordinate.
  2. Modify the last/duplicated coordinate so it's not a duplicate anymore. Apple must be ignoring exact duplicates.
  3. Give the last coordinate a long time stamp.

Example:

<wpt lat="37.782511" lon="-122.448453"><time>1970-01-01T00:00:00Z</time></wpt>
<wpt lat="37.782051" lon="-122.451981"><time>1970-01-01T00:00:05Z</time></wpt>
<wpt lat="37.782050" lon="-122.451981"><time>1970-01-01T10:00:00Z</time></wpt>
abc123
  • 8,043
  • 7
  • 49
  • 80