A: 

I had the same problem. This is very frustrating. It seems that the documentation for MKMapView is incorrect in some areas regarding datatypes.

If you set the region parameters as (double)s you'll get the error you're having. However if the region parameters are passed (float)s you'll get the correct behavior.

So try

MKCoordinateRegion region = {{0.0f,0.0f},{0.0f,0.0f}};

region.center.latitude = (float) [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.center.latitude"]; region.center.longitude = (float) [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.center.longitude"]; region.span.latitudeDelta = (float) [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.latitude"]; region.span.longitudeDelta = (float) [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.longitude"];

mapView.region = region;

Thanks for Your answer.I've tried to solve my problem this way, but still no luck...I'm quite sure that the problem is truncation of double to float, but for now have no idea how to fix it.Anyone else please?
Kamil Nomtek.com
A: 

I can't verify that this works. Can anyone else do so? I'd be willing to bet that what you're seeing is the effect of truncation of your doubles into floats. In some instances, when this happens to me, I've found I can multiply the span by 0.9999 and reset the region, and then it'll be what I want. But not all regions - sometimes it's very different, up to 20% different, especially for small spans.

Colin
er, sorry - this is related to the comment below starting with: "I had the same problem. This is very frustrating..."
Colin
+3  A: 

The issue here is when you set the region, the map zoom level "snaps" out to the nearest zoom threshold. (I suspect these zoom thresholds are the amounts of zoom you get when you double-tap or two-finger-tap)

So if the map is showing zoom level 1 for instance, and you set the region to that same span value thusly: region = [mapView region]; [mapView setRegion:region]; it will "snap" out to the nearest zoom level above level 1, i.e. level 2 and you will zoom out by about a factor of two.

The workaround for the original poster is to reduce the span values slightly before setting the region, so that when the view snaps out, it snaps out to the zoom level it was on, not the one above.

e.g.

region.span.latitudeDelta = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.latitude"] * 0.999;

region.span.longitudeDelta = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.longitude"] * 0.999;

If the user had been zooming with double-taps (and hence jumping from threshold to threshold) this works pretty well, returning them to the same view almost exactly.

However if they pinch-zoom and the view is halfway between the zoom thresholds it will still snap out to the next level. Not so good in that case but there is no fix as yet.

There are open bugs on Apple radar for this, hopefully it will be fixed in a future release.

Crufty
A: 

OK, so I've been struggling with this issue for some time now and I think that I've come up with an effective workaround inspired by Crufty's theory (http://stackoverflow.com/questions/1383296/why-mkmapview-region-is-different-than-requested/1671802#1671802). Basically, if you set the map view region with the values that you fetch from your NSUserDefaults after the map view has done its initial load (complete with "snap out" behavior), the map region will be what you'd expect it to be. The trick is to find a hook in your application code somewhere downstream from the map view having been initialized. Not pretty, but it works perfectly for me. Thanks to Crufty for the insight.

marturi
A: 

I have same problem... load my map...move, zoom...and then save to SQLite region

load region and I have: saved region: 68.966728 58.776088 map loaded region: 77.988893 67.500000

any idea for this differences ?

and any way for correct this problem ?

ciao !

joker