Step 1. Generate gpx file.
Go to http://www.bikehike.co.uk/mapview.php or some similar websites to generate a gps path file which ended with .gpx. Download it, and it shall looks like:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<rtept lat="-37.897000" lon="144.673920">
<ele>13</ele>
<time>2013-12-02T12:35:19Z</time>
<name>pt0</name>
</rtept>
...
...
...
<rtept lat="-37.897970" lon="144.671830">
<ele>13</ele>
<time>2013-12-02T12:36:35Z</time>
<name>pt1</name>
</rtept>
</gpx>
Step 2. Modify the gpx file.
This format is not compatible with Xcode. So we need to do some fix. First, delete the content which is meaningless for Xcode (shown above). Then, replace all rtept with wpt . It should looks like this after modification:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<wpt lat="-37.897000" lon="144.673920">
<ele>13</ele>
<time>2013-12-02T12:35:19Z</time>
<name>pt0</name>
</wpt>
...
...
...
<wpt lat="-37.897970" lon="144.671830">
<ele>13</ele>
<time>2013-12-02T12:36:35Z</time>
<name>pt1</name>
</wpt>
</gpx>
Step 3. Load the modified gpx file to Xcode.
After launching app from Xcode and running it in Simulator, go back to Xcode and add the gpx file to your project (following graph). Then the your new location/path will be showed in this list. Click to choose it.
Step 4. Check it.
When your app is still running in Simulator, click the "home" button of your iPhone/iPad Simulator. Then open the default map app, and show the current location. The movement will be exactly the same as you made from http://www.bikehike.co.uk/mapview.php.
Something worth mention:
1. Several default movements are available from Simulator menu ->Debug->Location.
2. The speed of customised path seems possibly to be controlled by the <time> rag in gpx file? I am not sure about this. But anyway, you can set the speed when you make the path on the website.
No comments:
Post a Comment