Setting Your Location in the iOS 5.0 Simulator

After upgrading my development tools to XCode 4.2 and iOS 5, I started to run into location unavailable errors when running in the iOS Simulator.

Having battled with the Android Emulator over the years, I figured there was a new location services setting I missed.

After a quick look at the iOS Simulator’s debug menu I found what I was looking for. Apple has changed the Location options for the better. You now have full control over their settings, similar to the Android emulator, just much easier.

By default the simulator will have no location defined.  Depending on your development platform this can surface in a variety of errors.  Below is the error Appcelerator’s Titanium provides.

step1

To define your location, simply open the iOS Simulator and select the Debug option, then select Location.  This has seven options:

  1. None – This will not return any location information. You can use this to test when the GPS is unavailable.
  2. Custom Location – This allows you to set a specific Latitude and Longitude.
  3. Apple Stores – Uses an Apple Store’s coordinates
  4. Apple – Apple headquarters coordinates
  5. City Bicycle Ride – Simulation of a bicycle ride in Cupertino, ie the device simulate it is moving
  6. City Run – Simulation of a run in Cupertino, ie the device simulate it is moving
  7. Freeway Drive – Simulation of a drive in Cupertino, ie the device simulate it is moving

I have a series of geo location test cases, so I tend to use the Custom Location option since it allows me to enter specific coordinates.

step2

This will open a dialog that allows you to enter your Latitude and Longitude.

step3

Press Ok, and you are ready to go.  The iOS Simulator will remember your Custom Location between restarts of the simulator.  You will need to remember to update your Latitude and Longitude when testing different scenarios or traveling. But Apple has made the process extremely straight forward.

done

The new location options in the iOS 5 simulator are a big improvement for anyone doing location based applications.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s