Testing Locations in the iPhone Simulator2:49 with Amit Bijlani
In this Treehouse Quick Tip, we will learn how to test locations in the iPhone simulator. When building with location service, you want to be able to test various locations to make sure you're app is functioning correctly.
This video doesn't have any notes.
[Treehouse presents: Quick Tips--Test Locations on the iPhone Simulator in iOS with Amit Bijilani] ?[music]? 0:00 Hi, I'm Amit and in this Treehouse quick tip we will learn how to test 0:05 locations in the iPhone simulator. 0:09 When building with location service, you want to be able to test 0:12 various locations to make sure you're app is functioning correctly. 0:16 And you probably want to test these locations right in the simulator 0:21 without having to load the app on your device and walk around or run around. 0:25 So let's find out how. 0:31 I have created a very basic location services app, 0:33 where I display a map with the current location highlighted with a blue dot. 0:36 Mostly when you run a location services application in the simulator, 0:41 it defaults to San Francisco as its current location. 0:46 To test it with other locations, you have an option in the debug bar 0:50 to choose from several system-generated locations. 0:55 So if you go to Xcode and select your debug bar, 0:59 there is a location services icon there, and you can select from several different locations. 1:04 And there's Johannesburg. Select Russia. London. You get the idea. 1:11 But what if you wanted to test with a location that is not on this list? 1:21 Well it's very easy actually; all you have to do is add a GPX file to your project. 1:26 So let's go back to Xcode and stop our project. 1:34 To add a GPX file, you need to select file, new, and then select file once again. 1:38 Select resource, and then make sure you have GPX file selected. 1:48 Hit next--you will have to provide it with a name. 1:54 I usually provide it with the name of the location that I will be adding. 1:57 So, I will be adding Manhattan. 2:02 Now this is a simple XML file with 3 things that you need to consider-- 2:06 the latitude, the longitude, and the name of the place. 2:11 So let's go ahead and change the name of the place to say Manhattan. 2:15 And of course, then provide it with the latitude and longitude. 2:21 Now when we run our application, Manhattan shows up as one of the options in the debug bar. 2:25 And there you go; now you can test with Manhattan as a location for your location services app. 2:37 Now you're not bound to any location when testing in the simulator. 2:43 So happy testing. 2:47
You need to sign up for Treehouse in order to download course files.Sign up