MapKit reports span with zero extents to delegate when zooming in

Originator:tomsax
Number:rdar://7013126 Date Originated:6/26/2009
Status:closed Resolved:duplicate/6873430
Product:iPhone Product Version:3.0 7A341
Classification:Serious Bug Reproducible:Always
 
STEPS:

Build the simplest possible MapView app.
Implement the regionDidChangeAnimated: method and set the delegate.
Run the app in the simulator or on the iPhone (in my case an original iPhone).
Zoom from the global view into the Daly City, CA area.

(See attached project.)

RESULT:

As you zoom in, things work as expected in the delegate callback until you suddenly start getting a mapView.region that has longitudeDelta and latitudeDelta set to zero.

EXPECT:

The correct longitude and latitude extents at all zoom levels.

This is a really bad problem, as it makes it impossible to know what annotations should be included in the view. My app shows different sets of pins at different zoom levels, just as is possible with the Google Maps web API. Without knowing the extents, I can't know which set of pins to show, much less the correct subset of those pins.

SAMPLE OUTPUT:

These lines show the console output of the attached project running, with the longitude and latitude center shown as an ordered pair followed by the longitude and latitude extents.

2009-06-26 21:00:49.394 MapViewRegionBug[11962:20b] (-97.0312, 37.44) 56.25 x 62.5933
2009-06-26 21:00:52.635 MapViewRegionBug[11962:20b] (-97.0312, 34.8585) 158.906 x 142.633
2009-06-26 21:00:59.274 MapViewRegionBug[11962:20b] (-97.247, 36.7876) 84.7266 x 90.8922
2009-06-26 21:01:01.156 MapViewRegionBug[11962:20b] (-97.3589, 37.8886) 43.5938 x 48.7332
2009-06-26 21:01:02.455 MapViewRegionBug[11962:20b] (-97.4069, 38.2478) 28.6523 x 32.1215
2009-06-26 21:01:04.826 MapViewRegionBug[11962:20b] (-120.589, 38.467) 28.6523 x 32.0346
2009-06-26 21:01:09.773 MapViewRegionBug[11962:20b] (-120.589, 38.6707) 20.2148 x 22.7217
2009-06-26 21:01:11.127 MapViewRegionBug[11962:20b] (-120.58, 38.7905) 14.4141 x 16.1105
2009-06-26 21:01:13.291 MapViewRegionBug[11962:20b] (-120.561, 38.8513) 11.4697 x 12.7892
2009-06-26 21:01:17.688 MapViewRegionBug[11962:20b] (-120.555, 38.9813) 5.99854 x 6.6768
2009-06-26 21:01:19.179 MapViewRegionBug[11962:20b] (-122.417, 38.3541) 5.99854 x 6.73613
2009-06-26 21:01:22.656 MapViewRegionBug[11962:20b] (-122.38, 37.3829) 5.99854 x 6.8253
2009-06-26 21:01:25.915 MapViewRegionBug[11962:20b] (-122.38, 37.464) 2.71362 x 3.08672
2009-06-26 21:01:29.148 MapViewRegionBug[11962:20b] (-122.378, 37.4986) 1.39526 x 0.571346
2009-06-26 21:01:35.237 MapViewRegionBug[11962:20b] (-122.428, 37.6858) 1.38977 x 1.58669
2009-06-26 21:01:37.454 MapViewRegionBug[11962:20b] (-122.428, 37.7045) 0 x 0
2009-06-26 21:01:41.064 MapViewRegionBug[11962:20b] (-122.428, 37.7101) 0 x 0

Sample code added to Apple bug report, also available at http://homepage.mac.com/tomsax/openradar/MapViewRegionBug.zip


Comments

The bug is even worse...

The problem is even worse than I initially reported. In addition to frequently reporting an obviously bad span, both the phone and simulator also occasionally report reasonable-looking but incorrect spans. For example, here's a log of zooming into the downtown San Francisco area, then scrolling a few pixels twice.

2009-07-01 09:55:24.764 MapViewRegionBug2701:207 0.0216293 x 0.0320091

2009-07-01 09:55:26.537 MapViewRegionBug2701:207 0.086174 x 0.0778694

2009-07-01 09:55:30.883 MapViewRegionBug2701:207 0.086174 x 0.0781441

In the first line, you can see the center point with span extents of 0.02 and 0.03 degrees. On the next two lines, all I did was scroll without changing the zoom level, and yet the extents increased by a factor of 4 (to the correct values, the first span was way too small, causing pins to not be shown).

I ran in to this same issue. I was able to work around the zeros well enough by just adding some if != 0 logic, but that doesn't help with incorrect values.

It seems there's some bugs all around in the map view region eventing/setting code. I've also been struggling with the programmatic region setting bug described here: http://www.openradar.me/6816139

By alex.johnson at 2009-08-06 19:55:45.609971 (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!