Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKMapView fails to load tiles with HTTP 410 error

I have a problem with MKMapView. Map fails to load tiles when I zoom it in.

-(void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error 

Error:

Domain=GEOErrorDomain Code=-204 "(null)" UserInfo={SimpleTileRequesterUnderlyingErrors=( "Error Domain=GEOErrorDomain Code=-204 \"(null)\" UserInfo={HTTPStatus=410, NSErrorFailingURLStringKey=http://gspe19.ls.apple.com/tile.vf?flags=1&style=20&size=2&scale=0&v=11037825&z=15&x=6205&y=12336&sid=0246704635757302674107153038443966765357&accessKey=1454685602_q3bVUYvHBdxsSo0A_j0fK7EyQ9b21NPShV7GRLzr4WFkkhxB4vO7%2BlXcGsXJ4zZHvhTaLVWsyPa3PlU60cDrmrFwmwCYBGrLA9mChV%2FHoRHoTU9AGI72VQP9UKZW%2B0GKqfRhpcw4xr%2F%2FTTVgJZ7wU4U4KnA8K2rVVQ%2FOfFHJq7OO4nYecTvy0ur4I9D3Sxf%2Btn9DcXU8agDRJignB}", ...

EDIT: Seems like it is related to cache somehow, but I'm not sure. This problem disappears for some time after loading the same map region in Maps application.

Thanks in advance

like image 402
mike-dutka Avatar asked Feb 05 '16 14:02

mike-dutka


2 Answers

I analysed and described the problem on Apple developer forum: https://forums.developer.apple.com/thread/43077


There is a problem with MapKit on iOS - map sometimes fails to load, another time it loads partially, displaying plain grid for a tile which failed to load. The problem happens systemwide in every app that uses MapKit, even in Apple Maps app. The problem happens on both iPhones (6+) and iPads (iPad Air, iPad Air 2, iPad Mini) and a range of iOS versions (9.0, 9.0.2, 9.2.1). Furthermore it seems to happen more often when map zoom is high. The problem is very hard to reproduce, because it looks to happen randomly, persists on affected device for some time and suddenly disappears.

I managed to analyse network traffic and found possible reason of this strange behaviour. Network requests associated with missing tiles fail with HTTP status code 410 and empty content:

GET http://gspe19.ls.apple.com/tile.vf?flags=1&style=13&size=2&scale=0&v=11040322&z=15&x=17923&y=10756&sid=SOME_SID_1&accessKey=SOME_ACCESS_KEY_1 <- 410  
GET http://gspe19.ls.apple.com/tile.vf?flags=1&style=20&size=2&scale=0&v=11040322&z=15&x=17923&y=10756&sid=SOME_SID_1&accessKey=SOME_ACCESS_KEY_1 <- 410  
...  

'v' parameter seems to be a map version number and grow with time. It looks that the version number can change after a 'geo_manifest' network call, which happens from time to time:

GET https://gspe35-ssl.ls.apple.com/geo_manifest/dynamic/config?application=geod&application_version=1&country_code=PL&hardware=iPad4,2&os=ios&os_build=13C75&os_version=9.2  

After downloading new geo_manifest, version number becomes valid once again and every tile request ends successfully with HTTP status code 200:

GET http://gspe19.ls.apple.com/tile.vf?flags=1&style=13&size=2&scale=0&v=11040529&z=15&x=17923&y=10756&sid=SOME_SID_2&accessKey=SOME_ACCESS_KEY_2 <- 200  
GET http://gspe19.ls.apple.com/tile.vf?flags=1&style=20&size=2&scale=0&v=11040529&z=15&x=17923&y=10756&sid=SOME_SID_2&accessKey=SOME_ACCESS_KEY_2 <- 200  
...  

I used an lldb to confirm, that a stale geo_manifest is the reason of 410 responses. I ran an arbitrary app on device that showed the symptoms using Xcode. Some tiles were missing on a MKMapView, and 410 responses appeared in network traffic. I closed the map, paused execution with lldb, executed a private GeoService framework method that seemed to force geo_manifest update:

(lldb) po [[GEOResourceManifestManager sharedManager] forceUpdate]  

After resuming execution, geo_manifest update request appeared in network traffic. After opening map view, successful tile responses appeared and map was fully loaded. Looks like com.apple.geod daemon itself fails to query for new geo_manifest from time to time. Because the problem is so ephemeral, it was impossible to find any com.apple.geod errors in device console logs.

Following questions arise: why do com.apple.geod, GeoServices or MapKit not try to query for new geo_manifest when tile request results in 410 response? Is that a known issue? Does Apple plan to fix this in future iOS versions?

EDIT: Fixed in iOS 10 (https://openradar.appspot.com/radar?id=6075032430182400).

like image 174
kam800 Avatar answered Nov 12 '22 12:11

kam800


My Mac OS X MKMapView based application has also been failing to load tiles when zoomed in. It's been getting worse over the last few weeks. I haven't been logging the mapViewDidFailLoadingMap: errors, but I've just started doing that.

To check it's not my code, I created a completely empty Mac OS X test app from scratch in XCode. This has a single MKMapView placed in a single window using interface builder. No code in the application was written by me. This test application also exhibits the problem.

While the MKMapView is having trouble displaying tiles, the Maps.app application is displaying tiles perfectly. So it's not my internet connection.

I'm running on a laptop, and I have a suspicion that the problem gets worse the longer the time since the computer was fully rebooted. E.g. I normally just close the lid and the computer sleeps at night. A full reboot last night fixed the problem and tiles are currently loading correctly.

Some further information:

  • The minimum deployment target of my application is Mac OS X 10.11
  • The tests are being run on OS X El Capitan 10.11.3
  • The map is in hybrid mode.
  • Restarting the application doesn't fix the problem.
  • Location: UK
  • The problem occurs with both google's DNS and my ISP's DNS.

If the problem re-occurs I will be submitting a bug report.

Update (6th Feb 2016): Have submitted a bug report to developer.apple.com detailing what I'm seeing. Would recommend that anyone else experiencing the problem also submits a bug report to apple with whatever data that you have. Because this could be quite hard for them to reproduce.

Update (7th Feb 2016): Having slept the laptop last night the problem has reoccurred. Now that I'm logging mapViewDidFailLoadingMap: messages, I'm seeing errors like this:

Error Domain=GEOErrorDomain Code=-204 "(null)" UserInfo={SimpleTileRequesterUnderlyingErrors=( "Error Domain=GEOErrorDomain Code=-204 \"(null)\" UserInfo={HTTPStatus=410, NSErrorFailingURLStringKey=http://gspe19.ls.apple.com/tile.vf?flags=1&style=20&size=2&scale=0&v=...&z=...&x=...&y=...&sid=...&accessKey=...}", ...

Have updated the developer.apple.com bug report with the new information.

Update (5th April 2016): Issue is still present on OS X 10.11.4. Apple have just marked my bug report as a duplicate of another bug report.

Update (20th May 2016): Issue is still present in OS X 10.11.5.

Update (23th July 2016): Issue is still present in OS X 10.11.6. Have updated my developer.apple.com bug report with information that the issue is still present.

Update (3rd Jan 2016): So far I haven't seen the issue occurring in macOS 10.12 (Sierra). However, I have seen all of the map views that I had opened simultaneously refresh their tiles. Therefore I suspect the issue is possibly being detected and the tile caches are purged.

like image 4
Wing Surface Avatar answered Nov 12 '22 13:11

Wing Surface