I’m running this on a device and the problem I’m having is that it finds the users location fine and zooms to that location with no problems. The problem I’m having is that the location is constantly changing (very slightly) even with my device sitting on my desk. This makes it so that if I zoom out or swipe to a different location on the map, it automatically takes me back to the zoomed in view constantly. I’m guessing it’s just having a hard time pinpointing my exact location. Also, I’d like to utilize this to not zoom in on the users location, but instead, a particular region, like a state but I’m having trouble figuring that part out.
I would take a look at the level of accuracy you are looking for, that will cause the map to zoom frequently if it’s set too high with the way the code is set up.
I just came across this post looking for the answer to this problem myself. I know the post is a bit old now but I found what the problem is and thought it might help someone else out. The problem is the
(void)mapView: (MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
method in the ViewController.m file. Every time the user’s location is updated it will try and zoom to the users location, but since you really aren’t moving its causing this zoom effect. I don’t know why the message is being sent since the device is just sitting on the desk, but if you comment this method out it works fine without the zooming effect.
If anyone wants to add why the message is being sent all the time that the user’s location has updated when it hasn’t would be helpful.