I've read through countless posts here on stack and apple's docs and can't find anything to solve this problem.
The issue is if you set mapView.showsUserLocation = YES, then MapKit will start making it's own GPS queries to your phone.
From apple docs:
Setting this property to YES causes the map view to use the Core Location framework to find the current location. As long as this property is YES, the map view continues to track the user’s location and update it periodically.
If you also want to use CLLocationManager, then when you make a call to [mylocationmanager startUpdatingLocation], then you are making a second GPS query on your phone.
Now you have 2 separate processes asking for GPS location.
Not a problem on the simulator, but if you try it on a real phone it will take a very very long time to get the GPS location. It is also inconsistent 10seconds - 1 minute, whereas if you turn off mapView.showsUserLocation it takes 2-3 seconds very consistently.
In general it seems like a very bad practice to use both.
For flexibility and control, I'd rather use CLLocationManager, but if you don't set mapView.showsUserLocation = YES, then you don't get the blue dot!
I tried the usual overwrite annotation methods: eg:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
if ([annotation isKindOfClass:MKUserLocation.class]) {
//it's the built-in user location annotation, return nil to get default blue dot...
return nil;
}
//handle your custom annotations...
}
But it doesn't work, most probably because there is never a call to actually place a user annotation on the map.
So does anyone have a solution to only use CLLocationManager to place the user's location on the map?