Since the version 4.2 XCode includes the option to test the GPS features of our iOS applications on the iPhone simulator by selecting among a few locations from a defaul list which includes cities as London, New York, Tokio, etc. The procedure is quite simple you only have to pick up one citiy in your XCode project and when you launch your application on the iPhone simulator it will behave as if you were in that city. This is really useful because by example a developer in London can test his application as if he were in Tokio and avoid bad user experience in this location. But another interesting thing we can do is to test how our application will work if a GPS fail happened. Let's see how.
Those predetermined locations are saved on as GPX files. GPX is an open light-weight XML data format for the interchange of GPS data between applications. XCode 4.2 offer us the possibility to
add our custom locations by creating new GPX files and including them on your XCode project. The way we can force a GPS fail is just creating a GPX file what includes wrong geographical coordinates. By example
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode">
<wpt lat="77777777747,485317" lon="19,073570">
<name>Force a GPS fail</name>
</wpt>
</gpx>
You can get more information about the schema an examples in the web site http://www.topografix.com/gpx.asp