From 7a3b05a5bc227e6d5d2787c5d3a60973c57fa92e Mon Sep 17 00:00:00 2001 From: DaidoujiChen Date: Fri, 16 Jan 2015 11:29:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AF=AB=E6=B3=95=E4=B8=8A?= =?UTF-8?q?=E7=9A=84=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HentaiDownloadCenter/HentaiDownloadBookOperation.m | 8 +++++++- e-Hentai/PhotoViewController/PhotoViewController.m | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/e-Hentai/HentaiDownloadCenter/HentaiDownloadBookOperation.m b/e-Hentai/HentaiDownloadCenter/HentaiDownloadBookOperation.m index 3fc1224e..5d316975 100644 --- a/e-Hentai/HentaiDownloadCenter/HentaiDownloadBookOperation.m +++ b/e-Hentai/HentaiDownloadCenter/HentaiDownloadBookOperation.m @@ -106,11 +106,17 @@ - (void)downloadResult:(NSString *)urlString heightOfSize:(CGFloat)height isSucc self.failCount++; self.maxHentaiCount = [NSString stringWithFormat:@"%ld", [self.maxHentaiCount integerValue] - 1]; + NSUInteger removeIndex = NSNotFound; for (NSString *eachURLString in self.hentaiImageURLs) { if ([eachURLString isEqualToString:urlString]) { - [self.hentaiImageURLs removeObject:eachURLString]; + removeIndex = [self.hentaiImageURLs indexOfObject:eachURLString]; + break; } } + + if (removeIndex != NSNotFound) { + [self.hentaiImageURLs removeObjectAtIndex:removeIndex]; + } } } self.status = HentaiDownloadBookOperationStatusDownloading; diff --git a/e-Hentai/PhotoViewController/PhotoViewController.m b/e-Hentai/PhotoViewController/PhotoViewController.m index 9ad38288..83233567 100644 --- a/e-Hentai/PhotoViewController/PhotoViewController.m +++ b/e-Hentai/PhotoViewController/PhotoViewController.m @@ -252,11 +252,17 @@ - (void)downloadResult:(NSString *)urlString heightOfSize:(CGFloat)height isSucc self.failCount++; self.maxHentaiCount = [NSString stringWithFormat:@"%ld", [self.maxHentaiCount integerValue] - 1]; + NSUInteger removeIndex = NSNotFound; for (NSString *eachURLString in self.hentaiImageURLs) { if ([eachURLString isEqualToString:urlString]) { - [self.hentaiImageURLs removeObject:eachURLString]; + removeIndex = [self.hentaiImageURLs indexOfObject:eachURLString]; + break; } } + + if (removeIndex != NSNotFound) { + [self.hentaiImageURLs removeObjectAtIndex:removeIndex]; + } } } }