Utsav Dusad
Utsav Dusad

Reputation: 2199

Where is the cache for SDWebImage?

I checked the NSBundle but couldn't find the cache where the images are saved by SDWebImage. Is the cache even enabled (see code below)? According to the Docs it does the caching management.

As given in docs:

Just #import the UIImageView+WebCache.h header, and call the sd_setImageWithURL:placeholderImage: method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be handled for you, from async downloads to caching management.

#import <SDWebImage/UIImageView+WebCache.h>

...

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *MyIdentifier = @"MyIdentifier";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                           reuseIdentifier:MyIdentifier] autorelease];
        }

        // Here we use the new provided sd_setImageWithURL: method to load the web image
        [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
                          placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

        cell.textLabel.text = @"My Text";
        return cell;
    }

Upvotes: 0

Views: 2830

Answers (2)

Payal Maniyar
Payal Maniyar

Reputation: 4402

Search below line of code in your project. _diskCachePath is the cache of SDWebImage.

if (![_fileManager fileExistsAtPath:_diskCachePath]) {
                [_fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];
            }

Upvotes: 1

nishith Singh
nishith Singh

Reputation: 2998

In your sandbox's Library folder

Your Application ID/Library/Caches/com.hackemist.SDWebImageCache.default/

Upvotes: 2

Related Questions