diff --git a/SDWebImage/Core/SDWebImageManager.h b/SDWebImage/Core/SDWebImageManager.h index c7e52ca9..36c3e4a5 100644 --- a/SDWebImage/Core/SDWebImageManager.h +++ b/SDWebImage/Core/SDWebImageManager.h @@ -261,6 +261,17 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager]; */ - (void)cancelAll; +/** + * Remove the specify URL from failed black list. + * @param url The failed URL. + */ +- (void)removeFailedURL:(nonnull NSURL *)url; + +/** + * Remove all the URL from failed black list. + */ +- (void)removeAllFailedURLs; + /** * Return the cache key for a given URL, does not considerate transformer or thumbnail. * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key. diff --git a/SDWebImage/Core/SDWebImageManager.m b/SDWebImage/Core/SDWebImageManager.m index a4872846..1f2bcdcc 100644 --- a/SDWebImage/Core/SDWebImageManager.m +++ b/SDWebImage/Core/SDWebImageManager.m @@ -228,6 +228,21 @@ static id _defaultImageLoader; return isRunning; } +- (void)removeFailedURL:(NSURL *)url { + if (!url) { + return; + } + SD_LOCK(self.failedURLsLock); + [self.failedURLs removeObject:url]; + SD_UNLOCK(self.failedURLsLock); +} + +- (void)removeAllFailedURLs { + SD_LOCK(self.failedURLsLock); + [self.failedURLs removeAllObjects]; + SD_UNLOCK(self.failedURLsLock); +} + #pragma mark - Private // Query normal cache process