Testing custom location with simulator

馋奶兔 提交于 2019-12-06 02:56:16

Add a GPX file to your project and add waypoints to it. When your app is running under simulation use the Simulate Location feature of XCode (the little way-arrow sitting on the debug bar at the bottom) and choose your GPX file. XCode will then start supplying coordinates to your app.

Example GPX file contents:

<?xml version="1.0"?>
<gpx>
  <wpt lat='33.749272' lon='-84.388261'><name>Atlanta, Georgia</name></wpt>
  <wpt lat='42.7335'   lon='-84.5467'><name>Lansing, Michigan</name></wpt>
  <wpt lat='32.361667' lon='-86.279167'><name>Montgomery, Alabama</name></wpt>
  <wpt lat='38.576667' lon='-92.173611'><name>Jefferson City, Missouri</name></wpt>
  <wpt lat='41.590833' lon='-93.620833'><name>Des Moines, Iowa</name></wpt>
</gpx>

Note that the simulator will 'connect the dots' between two waypoints (in the example above it will generate locations along a line between Atlanta, Georgia and Lansing, Michigan.

This works for me:

  1. Go into the Settings application in the simulator
  2. Navigate to General -> International -> Region Format -> (Choose a region)
  3. Specify a region

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!