I read countless posts here on the stack and apple docs and can't find anything to solve this problem.
The problem is that you set mapView.showsUserLocation = YES, then MapKit will start creating your own GPS requests on your phone.
From apple documents:
Setting this property to YES causes the map to be used to use the main location of the frame to find the current location. While this property is YES, the map display continues to track user locations and updates periodically.
If you also want to use CLLocationManager, then when you make a call [mylocationmanager startUpdatingLocation], you make a second GPS request to your phone.
You now have 2 separate processes requesting a GPS location.
Not a problem on the simulator, but if you try it on a real phone, it will take a very long time to get the GPS location. It is also contradictory 10 seconds - 1 minute, whereas if you disable mapView.showsUserLocation, it will take 2-3 seconds very sequentially.
In general, it seems very bad practice to use both.
For flexibility and control, I would prefer to use CLLocationManager, but if you do not set mapView.showsUserLocation = YES, then you will not get a blue dot!
I tried the usual rewriting annotation methods: for example:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
if ([annotation isKindOfClass:MKUserLocation.class]) {
return nil;
}
}
But this does not work, most likely because in fact there is never a call to place the user's annotation on the map.
- CLLocationManager ?