I am using MKMapView on my application. i need to show current location on simulator.
is it possible. to show current location on simulator.
In the simulator, the user's current location is always in Cupertino, California.
If you're using Interface Builder to add your map view, simply check the "Shows User Location" check box in the Attributes Inspector for the map view. (Select the map view and type command-1
to display the attributes inspector.)
If you're adding or manipulating the map view programmatically, set the showsUserLocation property of the map view to YES
.
Update: It turns out that this is possible, just not using the built in map view functionality, and it doesn't always work.
Recent versions of the SDK (which have to run on Snow Leopard) can get the location of the machine the simulator is running on using CLLocationManager. You can then use this location to create an annotation to display on the map view. It won't behave like the built in "user's location indicator" (at least not without some work), but it will show the user's current location.
See this post for details of when this technique won't work.
See the "Related sample code" section of the CLLocationManager documentation for sample code that uses CLLocationManager and CLLocationManagerDelegate and then displays the user's location on a map view.