Test Location Changes in Simulator

PDF for offline use

Let us know how you feel about this

Translation Quality


0/250

Some location APIs such as Significant Location Change and Geofences require big changes in location to trigger events. The iOS Simulator offers an easy way to test location APIs without leaving your desk.

Recipe

  1. Launch the iOS Simulator. Then, open the iOS Simulator's Debug menu and select Location > Freeway Drive . This will simulate a coastal drive up California's highway 280:

  2. Deploy the application to the simulator. The simulator will begin feeding sample data to the application, which should respond appropriately. For example, running the Track Significant Location Change code in the simulator produces the following application log:

  3. If your application requires a custom location to test, choose the Location > Custom Location... option from the Debug menu, and specify your own latitude and longitude to test:

  4. You can check the device's simulated location by opening Google Maps in Safari on the simulator. Navigate to maps.google.com and make sure the location matches what you set:

Of course, testing on the simulator does not prove that your app will work as intended on an actual device. Before you ship your app, Xamarin recommends that you buy a plane ticket and make the drive yourself just to be sure.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.