iOS Core Location Add own custom location using GPX file

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

To check for location services we need real device but for testing purpose we can also use simulator and add our own location by following below steps:

  • add new GPX file into your project.
  • in GPX file add waypoints like
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode"> 
<!--
        Provide one or more waypoints containing a latitude/longitude pair. If you provide one
        waypoint, Xcode will simulate that specific location. If you provide multiple waypoints,
        Xcode will simulate a route visitng each waypoint.
 -->
<wpt lat="52.599878" lon="4.702029">
     <name>location name (eg. Florida)</name>
</wpt>
  • then go to product-->Scheme-->Edit Scheme and into RUN set default location as your GPX file name.


Got any iOS Question?