ios - RMTileCache background caching never reaches totalTiles count and never tells delegate it finished -


i'm using mapbox , rmtilecache's beginbackgroundcachefortilesource: preload tiles before rendering maps in client app. want preload tiles visible area of map zoom level 3 thru zoom level 7. so, pass current bounds of mapview using rect returned [mapview latitudelongitudeboundingbox]. viewcontroller implements rmtilecachebackgrounddelegate callbacks caching occurs , completes. receive callbacks on didbeginbackgroundcachewithcount:fortilesource: , didbackgroundcachetile:withindex:oftotaltilecount: however, tilecachedidfinishbackgroundcache: never called.

i stepped thru source of rmtilecache , noticed actual count of cached tiles in "progtile" never reaches calculated total count in "totaltiles". therefore, final callback, tilecachedidfinishbackgroundcache:, not reached.

i'm not sure how change (or if should change) totaltiles calculation. perhaps passing wrong viewing rect in initial call? i'm not totally clear if correct. can create simple fix calls tilecachedidfinishbackgroundcache: in case caching finishes, seems hide issue. guidance here appreciated.

for reference, test code straight forward:

#import "viewcontroller.h"  @interface viewcontroller ()  @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];      rmmapboxsource *onlinesource = [[rmmapboxsource alloc] initwithmapid:@"appleweed.control-room"];     mapview = [[rmmapview alloc] initwithframe:self.view.bounds andtilesource:onlinesource];     //mapview.delegate = self;     mapview.bouncingenabled = yes;     mapview.clusteringenabled = yes;     mapview.clustermarkersize = cgsizemake(40, 40);     mapview.clusterareasize = cgsizemake(40, 40);     mapview.zoom = 1;      rmsphericaltrapezium rect = [mapview latitudelongitudeboundingbox];     mapview.tilecache.backgroundcachedelegate = self;     [mapview.tilecache beginbackgroundcachefortilesource:mapview.tilesource     southwest:rect.southwest     northeast:rect.northeast     minzoom:3.0     maxzoom:7.0];  }  - (void)tilecache:(rmtilecache *)tilecache didbeginbackgroundcachewithcount:(int)tilecount fortilesource:(id <rmtilesource>)tilesource {      nslog(@"start");  }  - (void)tilecache:(rmtilecache *)tilecache didbackgroundcachetile:(rmtile)tile withindex:(int)tileindex oftotaltilecount:(int)totaltilecount {     // float percentcomplete = ((float)tileindex / (float)totaltilecount) * 100;     //nsstring *update = [nsstring stringwithformat:@"%.0f%%", percentcomplete];     //nslog(@"%@",update);  }  - (void)tilecachedidfinishbackgroundcache:(rmtilecache *)tilecache {      nslog(@"done!");  }  - (void)tilecachedidcancelbackgroundcache:(rmtilecache *)tilecache {      nslog(@"canceled!");  }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  @end 

is stopping @ same tile count each time? there map view visible @ same time? if pause app in debugger, doing once seems have stopped downloading tiles in background?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -