iOS: SDWebImageManager not caching image

Deadly 提交于 2019-12-02 05:45:41

my mother language is Chinese,not English.Maybe I cannot express my thought clearly,while I will try my best to tell my idea.if I confuse you , I feel sorry.

I cannot pod SDWebimage because my country blocks google sometimes,so I cannot reproduce your scenarios.While I still give your some advice which may help you

First of all, your gave us little context.Maybe you can post more information about member variables and properties.When I copy your code to the Xcode.I need add them by myself.

Second,you mean when you use
NSURL *imageURL = [NSURL URLWithString:[arry objectAtIndex:1]];,

sdwebimage hits urls every time , not use cache URLs? you can get the image source by NSLog the cacheType.

completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {  
                      if (image) {                                                    
                            NSLog(@"%d",cacheType);
                          [activityIndicator removeFromSuperview];
                          activityIndicator = nil;
                          [self.imageView setImage:image];
                     }
                  }];`

SDImageCacheTypeNone means image comes from network.

SDImageCacheTypeDisk means image comes from disk.

SDImageCacheTypeMemory means image comes from Memory.

Third,because the downloadWithURL:options:completed: is excuted not on the main thread. I doubt the sequence is the same with your thought.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!