Move key fetch outside of for loop

This commit is contained in:
Garrett Moon
2015-07-30 15:47:34 -07:00
parent faa6264b65
commit 3cbbaf758b

View File

@@ -206,8 +206,9 @@
- (void)waitForImageWithURLToBeCached:(NSURL *)URL
{
NSString *key = [self.imageManager cacheKeyForURL:URL processorKey:nil];
for (NSUInteger idx = 0; idx < 100; idx++) {
if ([[self.imageManager cache] objectForKey:[self.imageManager cacheKeyForURL:URL processorKey:nil]] != nil) {
if ([[self.imageManager cache] objectForKey:key] != nil) {
break;
}
sleep(50);
@@ -606,8 +607,9 @@
dispatch_semaphore_wait(semaphore, [self timeout]);
//small image should have been removed from cache
NSString *key = [self.imageManager cacheKeyForURL:[self JPEGURL_Small] processorKey:nil];
for (NSUInteger idx = 0; idx < 100; idx++) {
if ([[self.imageManager cache] objectForKey:[self.imageManager cacheKeyForURL:[self JPEGURL_Small] processorKey:nil]] == nil) {
if ([[self.imageManager cache] objectForKey:key] == nil) {
break;
}
sleep(50);