I am using SDWebImage
to display images asynchronously, and cache them, then to get them when in offline mode.
I am having an issue with SDWebImageDownloader
and UIImageView+WebCache
Cache when using offline mode, and that issue appears only when dealing with percent escaped URLs, that have some special characters like '{'.
In online mode all works fine, but in offline mode the images with URLs containing percent escapes are not loaded
[myImageView setImageWithURL:[urlImage percentEscapedURL]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
//image here is loaded in offline mode only if its URL does not need percent escapes
}];
The same issue with SDWebImageDownloader
.
I tried to debug SDImageView
behaviour, and it seems that it's using the iOS SDK NSCachedURLResponse
behaviour.
I am testing with https://github.com/rs/SDWebImage/ with iOS 7.0
Any one has got the same issue? any workaround?
SDWebImage has some property declared in SDWebImageManager.h
:
@property (strong) NSString *(^cacheKeyFilter)(NSURL *url);
There are the description of this property from corresponding file:
/**
* The cache filter is a block used each time SDWebImageManager need to convert an URL into a cache key. This can
* be used to remove dynamic part of an image URL.
*
* The following example sets a filter in the application delegate that will remove any query-string from the
* URL before to use it as a cache key:
*
* @code
[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) {
url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
return [url absoluteString];
}];
* @endcode
*/
I think you can try to do some changes in corresponding code.