Is there a way to manually update the current location on MKMapView and have the ‘blue marker pin’ displayed to indicate the new spot?
(I’m doing all this with inside the simulator because I don’t have my app certificate yet.)
My MKMapView instance is configured with ‘showsUserLocation’ as YES and when the map is initially shown, I see the ‘blue marker pin’ (based in Cupertino). When the user taps the ‘locate me’ button, I do a startUpdatingLocation with an instance of the CLLocationManager.
When I receive the new location update, I’d like to adjust the ‘blue pin’ on the map but setting the center coordinate on the map doesn’t seem to do it?
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
[self.mapView setCenterCoordinate:newLocation.coordinate animated:YES];
}
Because the simulator doesn’t have GPS functionality, I am manually sending the new location information to make the delegate call to 'locationManager:didUpdateToLocation:fromLocation'.
How can I get the blue pin to update on the map with the specified coordinates?
You probably won’t have any luck trying to manually change the device’s location from within your app, but you can change the simulated location in the iOS Simulator: From the simulator’s Debug menu, select “Location”, and then either choose one of Apple’s provided locations or enter a coordinate.