ios应用程序中的Mapbox缓存

时间:2015-02-10 19:47:41

标签: ios mapbox

在应用程序中我有一些mapViews,我想支持离线模式(缓存)。所以:用户安装的应用程序,主屏幕包含mapView,它应该缓存它。然后用户关闭Wi-Fi和3G,并尝试查看另一个mapView(另一个viewController)。它现在没有下载。但主屏幕的地图还可以。我是否以错误的方式缓存?

配置地图的代码是相同的:

[[RMConfiguration sharedInstance] setAccessToken:@"pk.***"];
     RMMapboxSource *tileSource = [[RMMapboxSource alloc] initWithMapID:kMapboxMapID];
    [tileSource setCacheable:YES];
    [self.mapView.tileCache setBackgroundCacheDelegate:self];
    [self.mapView.tileCache beginBackgroundCacheForTileSource:tileSource southWest:CLLocationCoordinate2DMake(55.767363, 37.592843) northEast:CLLocationCoordinate2DMake(55.799801, 37.671229) minZoom:11 maxZoom:11];
    self.mapView = [[RMMapView alloc] initWithFrame:self.view.bounds andTilesource:tileSource];
    self.mapView.delegate=self;
    [self.view addSubview:self.mapView];

1 个答案:

答案 0 :(得分:1)

如果您没有使用RMTileCache的下载方法来预取地图区域,则仅当尝试在第二个视图控制器中查看地图区域时,此方法才有效与第一次看到的相同。