Authored by Justin R. Miller

refs #492: post errors with background tile fetch problems

... ... @@ -105,6 +105,12 @@ typedef enum : short {
* @param totalTileCount The total number of of tiles required for coverage of the desired geographic area. */
- (void)tileCache:(RMTileCache *)tileCache didBackgroundCacheTile:(RMTile)tile withIndex:(NSUInteger)tileIndex ofTotalTileCount:(NSUInteger)totalTileCount;
/** Sent upon error when trying to cache a tile in a background cache operation.
* @param tileCache The tile cache.
* @param error The error received.
* @param tile A structure representing the tile in question. */
- (void)tileCache:(RMTileCache *)tileCache didReceiveError:(NSError *)error whenCachingTile:(RMTile)tile;
/** Sent when all tiles have completed downloading and caching.
* @param tileCache The tile cache. */
- (void)tileCacheDidFinishBackgroundCache:(RMTileCache *)tileCache;
... ...
... ... @@ -406,6 +406,15 @@
});
}
}
else
{
if ([_backgroundCacheDelegate respondsToSelector:@selector(tileCache:didReceiveError:whenCachingTile:)])
{
[_backgroundCacheDelegate tileCache:weakSelf
didReceiveError:internalOperation.error
whenCachingTile:RMTileMake((uint32_t)x, (uint32_t)y, zoom)];
}
}
}];
[_backgroundFetchQueue addOperation:operation];
... ...
... ... @@ -35,4 +35,6 @@
- (id)initWithTile:(RMTile)tile forTileSource:(id <RMTileSource>)source usingCache:(RMTileCache *)cache;
@property (nonatomic, strong) NSError *error;
@end
... ...
... ... @@ -73,6 +73,17 @@
if ( ! data || error != nil)
{
if (error != nil)
{
self.error = error;
}
else
{
self.error = [NSError errorWithDomain:NSURLErrorDomain
code:NSURLErrorUnknown
userInfo:nil];
}
[self cancel];
}
else
... ...