GPX File does not load iOS Xcode

对着背影说爱祢 提交于 2019-12-20 01:59:15

问题


I am trying to simulate the locations, using a gpx file.

The file does not work in the Xcode nor does it show any error.

The file size is 1.1 MB , has a tracking data from startPoint (A) to startPoint (B).

Does that cause any issues, any suggestion?

Ref: Add GPX File to Xcode 6 Project


回答1:


I noticed the same issue (Xcode 9.2). If you are adding the .gpx file through the status bar at the bottom and it's not appearing:

Drag and drop the .gpx file directly in your project navigator window on the left (where all your program files are)

and it should then appear in the drop-down simulator icon.




回答2:


Found the actual reason is few tags of the content in the GPX file is not supported by XCode.

iOS does not support tags with tracking data.

<trk>
        <name>12</name>
        <trkseg>
            <trkpt lat="some value" lon="some value">
        </trkpt>
       <trkseg>
</trk>

So, get rid off all trk , trkseg tags. Now repleace trkpt with wpt.

That's it and you will be able to see simulation of your path.

Found the refernece at : http://deneymo.blogspot.com/2013/12/ios-customise-gps-path-for-simulator.html

A GPX file with only wpt points can be created here . http://gpx-poi.com

According to the following link https://developer.apple.com/library/content/documentation/IDEs/Conceptual/iOS_Simulator_Guide/CustomizingYourExperienceThroughXcodeSchemes/CustomizingYourExperienceThroughXcodeSchemes.html

Xcode and Simulator support specifying a route as a series of waypoints using the GPX <wpt> tag. The route (<rte>) and track (<trk>) tags are not supported.




回答3:


I have met this problem recently, and found that GPSBabel can convert track GPX file into waypoint format. Here is a sample command given in the document:

gpsbabel -i gpx -f blah.gpx -x transform,wpt=trk,del -o gpx -F converted.gpx



来源:https://stackoverflow.com/questions/43428073/gpx-file-does-not-load-ios-xcode

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