Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Not downloading all the needed tiles in beginBackgroundCacheForTileSource:southWest:northEast:minZoom:maxZoom: #656

Open
aleksandr-vin opened this issue Jul 19, 2015 · 3 comments

Comments

@aleksandr-vin
Copy link

I set up mapView and download tiles as in the example https://github.com/mapbox/mapbox-ios-sdk-offline


float maxDownloadZoom = 19.0;
float minDownloadZoom = 12.0;

mapView = [[RMMapView alloc] initWithFrame:self.view.bounds andTilesource:tileSource];

            mapView.showsUserLocation = NO;
            mapView.zoom = 15.5f;
            mapView.maxZoom = maxDownloadZoom;
            // center the map to the coordinates
            CLLocationCoordinate2D center = CLLocationCoordinate2DMake(59.93248,30.33656);
            mapView.centerCoordinate = center;
            mapView.clusteringEnabled = NO;
            // make map expand to fill screen when rotated
            mapView.autoresizingMask = UIViewAutoresizingFlexibleHeight |
            UIViewAutoresizingFlexibleWidth;

            CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(59.928656913601245,30.327072143554688);
            CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(59.93753684933923, 30.34977436065674);
            [mapView setConstraintsSouthWest:southWest northEast:northEast];

            RMTileCache *cache = [[RMTileCache alloc] initWithExpiryPeriod:0]; // never expires
            mapView.tileCache = cache;

            mapView.delegate = self;

then I download tiles in cache:

[mapView removeAllCachedImages];
mapView.tileCache.backgroundCacheDelegate = self;
                             [mapView.tileCache beginBackgroundCacheForTileSource:mapView.tileSource
                                                                        southWest:southWest
                                                                        northEast:northEast
                                                                          minZoom:minDownloadZoom
                                                                          maxZoom:maxDownloadZoom];

Then I stop my App, turn Airplane mode and run my App again. The result is that not all the tiles are shown on map, different tiles missing in different zoom-s.

I use a 1.6.0 version with #581 fix cherry-picked.

@Svantulden
Copy link

It seems some of the tiles you are trying to download failed. Try to use the backgroundCacheDelegate method - (void)tileCache:(RMTileCache *)tileCache didReceiveError:(NSError *)error whenCachingTile:(RMTile)tile and monitor that/set a breakpoint.

@aleksandr-vin
Copy link
Author

Yes, there are some calls of this delegate. But what should I do to recover these erroneous tiles?

@Svantulden
Copy link

I think retrying tiles is not supported in this library, you probably need to handle the errors yourselves. Maybe make a list of the erroneous tiles from that delegate method and retry them after? Or if the reason of the tiles failing is clear, fix that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants