阻止不执行

时间:2017-03-31 03:28:48

标签: ios objective-c sdwebimage

我正在以这种方式缓存下载和图像,但我的问题是这个queryDiskCacheForDisk块没有执行。

-(void)checkCache :(NSArray *)imgUrl
{
    float circleWidth=0.0;
    if (dm.screenWidth==320) {
        circleWidth=53.0;
    }

    else if(dm.screenWidth>320)
    {
        circleWidth=65.0;
    }
    CGRect circleFrame=CGRectMake(0, 0, circleWidth, circleWidth);
    __block UIImage *savedImage=[com circularScaleAndCropImage:[UIImage imageNamed:@"notFound"] frame:circleFrame];
    SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"TEAM_PROFILES"];
    [imageCache queryDiskCacheForKey:[imgUrl objectAtIndex:0] done:^(UIImage *image,SDImageCacheType cacheType) {
        // image is not nil if image was found

        if (image) {
            savedImage=[com circularScaleAndCropImage:image frame:circleFrame];

            NSLog(@"----image Cached------");
        }
        else
        {
            //[self performSelectorInBackground:@selector(getImageNew:) withObject:nil];
            savedImage=[self getImageNew:imgUrl];
            [imageCache storeImage:savedImage forKey:[imgUrl objectAtIndex:0]];
        }
    }];

    [arrayImages addObject:savedImage];
    [arrayTeamMemeberNames addObject:[imgUrl objectAtIndex:1]];
    [arrayEmpCodes addObject:[imgUrl objectAtIndex:2]];
    [arrEmpFullName addObject:[imgUrl objectAtIndex:3]];
    [arrEmpNumbers addObject:[imgUrl objectAtIndex:4]];
    if([arrayImages count]==[arrayTeamMembersUnfilter count])
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"imagesFilledContact" object:nil];
        NSLog(@"------POST NOTIFICATION-----");

    }
}

它总是添加我在开头分配的默认图像。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

在你阻止的情况下,我没有看到任何add操作。

你知道你的街区是最后一个要运行的部分吗?