Reputation: 5174
This is kinda the opposite of most questions on the topic. My issue isn't getting the user's location to show; it's getting it to STOP showing.
I have a view with an MKMapView. I set it's region equal to the user's current location, then I set it to not show the user location:
- (void)viewDidLoad
{
[super viewDidLoad];
AppDelegate *appDelegate=(id)[[UIApplication sharedApplication] delegate];
[self.mapView setShowsUserLocation:NO];
[self.mapView setRegion:MKCoordinateRegionMakeWithDistance([appDelegate.locationManager location].coordinate, 1000, 1000)];
[self.mapView setUserTrackingMode:MKUserTrackingModeNone];
/*Unrelated code*/
}
Even if I move this code to ViewWill/DidAppear, it doesn't work.
What am I doing wrong? I've tested that self.mapView exists and is not null -- I even ran a debugger command 'po [self.mapView removeFromSuperview]' to confirm I had the RIGHT MKMapView (it vanished, as expected).
Upvotes: 3
Views: 557
Reputation: 5174
This was actually a simulator bug.
Turns out the iOS 5 simulators put the location pin in, even when they're not supposed to. Doesn't happen on device.
Upvotes: 1